def test_main_dropboxignore_does_not_exists(main_mock): # GIVEN # WHEN with pytest.raises(SystemExit) as exit_exception: main() # THEN assert exit_exception.value.code == RETURN_CODES.DROPBOXIGNORE_DOES_NOT_EXISTS
def test_main_path_not_directory(main_mock): # GIVEN # WHEN with pytest.raises(SystemExit) as exit_exception: main() # THEN assert exit_exception.value.code == RETURN_CODES.PATH_IS_NOT_DIRECTORY
def test_main_with_wrong_number_of_arguments(main_mock): # GIVEN # WHEN with pytest.raises(SystemExit) as exit_exception: main() # THEN assert exit_exception.value.code == RETURN_CODES.WRONG_NUMBER_OF_ARGS
def test_main_scanning_directory_error(main_mock, initial_excludes_mock): # GIVEN initial_excludes_mock.side_effect = Exception() # WHEN with pytest.raises(SystemExit) as exit_exception: main() # THEN assert exit_exception.value.code == RETURN_CODES.SCANNING_ERROR
def test_main_parse_error(main_mock, parse_dropboxignore_mock): # GIVEN parse_dropboxignore_mock.side_effect = ParsingException() # WHEN with pytest.raises(SystemExit) as exit_exception: main() # THEN assert exit_exception.value.code == RETURN_CODES.PARSING_ERROR
def test_main_cannot_open_dropboxignore(main_mock, open_mock): # GIVEN open_mock.side_effect = Exception() # WHEN with pytest.raises(SystemExit) as exit_exception: main() # THEN assert exit_exception.value.code == RETURN_CODES.CANNOT_READ_DROPBOXIGNORE
def test_main_watch_error(main_mock, notifier_mock): # GIVEN notifier_mock().loop.side_effect = NotifierError('') # WHEN with pytest.raises(SystemExit) as exit_exception: main() # THEN assert exit_exception.value.code == RETURN_CODES.CANNOT_WATCH_PATH