Added basic tests of allowlist config args.
This commit is contained in:
parent
3aa2e378e3
commit
a3d3571a20
|
@ -37,4 +37,18 @@ def test_cmdline_mergeplan_min():
|
|||
ap = setup_argparse()
|
||||
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']
|
|
@ -45,3 +45,14 @@ def test_set_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',
|
||||
}]
|
||||
|
|
Loading…
Reference in New Issue