Exemple #1
0
def test_for_invalid_output_path(tmp_path):
    sut = cli.CLI()
    path = os.path.join(tmp_path, 'not_existent.path')
    assert not os.path.exists(path)
    sut.parse(args=[sample, '-o', '%s' % path])
    assert os.path.exists(path)
Exemple #2
0
def test_log_level_wrong():
    sut = cli.CLI()
    with pytest.raises(SystemExit) as e:
        sut.parse(args=[sample, '--loglevel=fubar'])
    assert "2" in str(e.value)
Exemple #3
0
def test_correctly_set_numeric(value, parameter_flag, method):
    sut = cli.CLI()
    sut.parse(args=[sample, '%s %s' % (parameter_flag, value)])
    assert getattr(sut, method) == value
Exemple #4
0
def test_log_level_set():
    sut = cli.CLI()
    sut.parse(args=[sample, '--loglevel=warning'])
    assert sut.get_log_level == logging.WARNING, "log level should be warning"
Exemple #5
0
def test_mode_default():
    sut = cli.CLI()
    sut.parse(args=[sample])
    assert sut.get_mode == Mode.COLOR
Exemple #6
0
def test_check_mode():
    sut = cli.CLI()
    sut.parse(args=[sample, '-m', 'motion'])
    assert sut.get_mode == Mode.MOTION
Exemple #7
0
def test_for_wrong_file():
    sut = cli.CLI()
    with pytest.raises(SystemExit) as e:
        sut.parse(args=[wrong_video])
    assert "10" in str(e.value)
Exemple #8
0
def test_for_correctly_set_file():
    sut = cli.CLI()
    sut.parse(args=[sample])
    assert sut.get_file.name == sample