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)
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)
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
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"
def test_mode_default(): sut = cli.CLI() sut.parse(args=[sample]) assert sut.get_mode == Mode.COLOR
def test_check_mode(): sut = cli.CLI() sut.parse(args=[sample, '-m', 'motion']) assert sut.get_mode == Mode.MOTION
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)
def test_for_correctly_set_file(): sut = cli.CLI() sut.parse(args=[sample]) assert sut.get_file.name == sample