40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
|
"""Test the commandline defined parameters correctly
|
||
|
"""
|
||
|
from fediblockhole import setup_argparse, augment_args
|
||
|
|
||
|
def shim_argparse(testargv: list=[], tomldata: str=None):
|
||
|
"""Helper function to parse test args
|
||
|
"""
|
||
|
ap = setup_argparse()
|
||
|
args = ap.parse_args(testargv)
|
||
|
args = augment_args(args, tomldata)
|
||
|
return args
|
||
|
|
||
|
def test_cmdline_no_configfile():
|
||
|
""" Test bare command with no configfile
|
||
|
"""
|
||
|
ap = setup_argparse()
|
||
|
args = ap.parse_args([])
|
||
|
|
||
|
assert args.config == '/etc/default/fediblockhole.conf.toml'
|
||
|
assert args.mergeplan == None
|
||
|
assert args.blocklist_savefile == None
|
||
|
assert args.save_intermediate == False
|
||
|
assert args.savedir == None
|
||
|
assert args.import_fields == None
|
||
|
assert args.export_fields == None
|
||
|
|
||
|
assert args.no_fetch_url == False
|
||
|
assert args.no_fetch_instance == False
|
||
|
assert args.no_push_instance == False
|
||
|
assert args.dryrun == False
|
||
|
|
||
|
assert args.loglevel == None
|
||
|
|
||
|
def test_cmdline_mergeplan_min():
|
||
|
""" Test setting mergeplan min
|
||
|
"""
|
||
|
ap = setup_argparse()
|
||
|
args = ap.parse_args(['-m', 'min'])
|
||
|
|
||
|
assert args.mergeplan == 'min'
|