def test_should_report_passed_tests_to_ci_server(self, teamcity, proxy): teamcity.return_value = False project = Project('basedir') mock_proxy = Mock() proxy.return_value = mock_proxy mock_proxy.and_test_name.return_value = mock_proxy mock_proxy.__enter__ = Mock(return_value=mock_proxy) mock_proxy.__exit__ = Mock(return_value=False) result = Mock() result.test_names = ['test1', 'test2', 'test3'] result.failed_test_names_and_reasons = {} report_to_ci_server(project, result) mock_proxy.fails.assert_not_called()
def test_should_report_passed_tests_to_ci_server(self, teamcity, proxy): teamcity.return_value = False project = Project("basedir") mock_proxy = Mock() proxy.return_value = mock_proxy mock_proxy.and_test_name.return_value = mock_proxy mock_proxy.__enter__ = Mock(return_value=mock_proxy) mock_proxy.__exit__ = Mock(return_value=False) result = Mock() result.test_names = ["test1", "test2", "test3"] result.failed_test_names_and_reasons = {} report_to_ci_server(project, result) mock_proxy.fails.assert_not_called()
def test_should_report_failed_tests_to_ci_server(self, teamcity, proxy): teamcity.return_value = False project = Project('basedir') mock_proxy = Mock() proxy.return_value = mock_proxy mock_proxy.and_test_name.return_value = mock_proxy mock_proxy.__enter__ = Mock(return_value=mock_proxy) mock_proxy.__exit__ = Mock(return_value=False) result = Mock() result.test_names = ['test1', 'test2', 'test3'] result.failed_test_names_and_reasons = { 'test2': 'Something went very wrong' } report_to_ci_server(project, result) mock_proxy.fails.assert_called_with('Something went very wrong')