def test_parse_args_fails_on_no_config_but_no_jailpath_and_package(): errormsg = "--package and --jailpath arguments must be specified together (or use --config)\n" shouldfail = [ "--package package", "--jailpath /some/path", ] for i in shouldfail: with pytest.raises(j.ArgumentError) as e: j.parse_args(i.split(" ")) assert errormsg == str(e.value)
def test_parse_args_fails_on_mutual_exclusions(): errormsg = "--package and --jailpath args are mutually exclusive to --config\n" shouldfail = [ "--config someconfig --package package --jailpath /some/path", "--config someconfig --package package", "--config someconfig --jailpath /some/path", ] for i in shouldfail: with pytest.raises(j.ArgumentError) as e: j.parse_args(i.split(" ")) assert errormsg == str(e.value)
def test_parse_args_fails_on_no_args(): errormsg = "--package and --jailpath arguments must be specified together (or use --config)\n" with pytest.raises(j.ArgumentError) as e: j.parse_args([]) assert errormsg == str(e.value)