Added basic tests of allowlist config args.

This commit is contained in:
Justin Warren 2023-01-15 10:10:52 +11:00
parent 3aa2e378e3
commit a3d3571a20
No known key found for this signature in database
2 changed files with 26 additions and 1 deletions

View File

@ -38,3 +38,17 @@ def test_cmdline_mergeplan_min():
args = ap.parse_args(['-m', 'min']) args = ap.parse_args(['-m', 'min'])
assert args.mergeplan == 'min' assert args.mergeplan == 'min'
def test_set_allow_domain():
"""Set a single allow domain on commandline"""
ap = setup_argparse()
args = ap.parse_args(['-A', 'example.org'])
assert args.allow_domains == ['example.org']
def test_set_multiple_allow_domains():
"""Set multiple allow domains on commandline"""
ap = setup_argparse()
args = ap.parse_args(['-A', 'example.org', '-A', 'example2.org', '-A', 'example3.org'])
assert args.allow_domains == ['example.org', 'example2.org', 'example3.org']

View File

@ -45,3 +45,14 @@ def test_set_mergeplan_min():
assert args.mergeplan == 'min' assert args.mergeplan == 'min'
def test_set_allowlists():
tomldata = """# Comment on config
allowlist_url_sources = [ { url='file:///path/to/allowlist', format='csv'} ]
"""
args = shim_argparse([], tomldata)
assert args.mergeplan == 'max'
assert args.allowlist_url_sources == [{
'url': 'file:///path/to/allowlist',
'format': 'csv',
}]