Пример #1
0
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
Пример #2
0
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
Пример #3
0
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
Пример #4
0
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
Пример #5
0
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
Пример #6
0
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
Пример #7
0
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