Exemple #1
0
def test_argparser_succeeds(args):
    opts = argparser.parse(args)

    assert opts.time == 10
    assert opts.output_path == pathlib.Path("output.txt")
    assert opts.show_diffs
    assert opts.config_path == pathlib.Path("config.cfg")
Exemple #2
0
def main():
    opts = argparser.parse(argv[1:])
    opts_validator.validate_opts(opts)
    sites = cfg_reader.parse_file(opts.config_path)
    cfg_validator.validate_websites(sites)
    checker = state_checker.StateChecker(sites, opts, num_threads=len(sites))
    checker.run()
Exemple #3
0
def test_args_are_parsed_and_validated(paths):
    cfg_file, out_file = paths
    args = ["-t", "70", "-o", str(out_file), "-d", str(cfg_file)]

    opts = argparser.parse(args)

    assert opts.time == 70
    assert opts.output_path == out_file
    assert opts.config_path == cfg_file
    assert opts.show_diffs

    validator.validate_opts(opts)
Exemple #4
0
def test_argparser_default_values():
    args = ["--output", "output.txt", "config.cfg"]
    opts = argparser.parse(args)

    assert opts.time == const.DEFAULT_T
    assert opts.show_diffs == const.DEFAULT_D
Exemple #5
0
def test_argparser_fails(args):
    with pytest.raises(SystemExit):
        argparser.parse(args)