Esempio n. 1
0
    def test_run_project_tests_with_target_other_than_default(self):
        test_service = mock.MagicMock()

        result = run_tests(test_service, target='rpi4')

        assert result.status_code == 0
        test_service.run_tests.assert_called_once_with([], 'rpi4')
Esempio n. 2
0
    def test_run_project_tests(self):
        test_service = mock.MagicMock()

        result = run_tests(test_service)

        assert result.status_code == 0
        test_service.run_tests.assert_called_once_with([], 'default')
Esempio n. 3
0
    def test_run_project_tests_with_patterns(self):
        test_service = mock.MagicMock()

        result = run_tests(test_service, files_or_dirs=['tests'])

        assert result.status_code == 0
        test_service.run_tests.assert_called_once_with(['tests'], 'default')
Esempio n. 4
0
    def test_run_project_tests_with_test_args(self):
        test_service = mock.MagicMock()

        result = run_tests(test_service, test_args=['arg1'])

        assert result.status_code == 0
        test_service.run_tests.assert_called_once_with((), 'default', ['arg1'])
Esempio n. 5
0
    def test_run_tests_fails_when_tests_fail(self):
        test_service = mock.MagicMock()
        test_service.run_tests.side_effect = TestsFailed()

        result = run_tests(test_service)

        assert result.status_code == 1
        test_service.run_tests.assert_called_once_with([], 'default')
Esempio n. 6
0
    def test_run_tests_fails_when_compilation_fails(self):
        test_service = mock.MagicMock()
        test_service.run_tests.side_effect = BuildError()

        result = run_tests(test_service)

        assert result.status_code == 1
        test_service.run_tests.assert_called_once_with([], 'default')
Esempio n. 7
0
    def test_run_tests_fails_when_no_tests_are_found(self):
        test_service = mock.MagicMock()
        test_service.run_tests.side_effect = NoTestsFound()

        result = run_tests(test_service)

        assert result.status_code == 0
        test_service.run_tests.assert_called_once_with((), 'default', ())
Esempio n. 8
0
    def test_run_tests_fails_when_current_directory_is_not_a_chromos_project(
            self):
        test_service = mock.MagicMock()
        test_service.run_tests.side_effect = NotACpmProject()

        result = run_tests(test_service)

        assert result.status_code == 1
        test_service.run_tests.assert_called_once_with([], 'default')