Exemple #1
0
 def test_add_and_report_test_names_status(self, mock_sink_init,
                                           mock_sink_close, mock_report):
     """Tests add_test_names_status."""
     test_names = ['test1', 'test2', 'test3']
     collection = ResultCollection(test_results=[PASSED_RESULT])
     collection.add_and_report_test_names_status(test_names,
                                                 TestStatus.SKIP)
     self.assertEqual(collection.test_results[0], PASSED_RESULT)
     unexpected_skipped = collection.tests_by_expression(
         lambda t: not t.expected() and t.status == TestStatus.SKIP)
     self.assertEqual(unexpected_skipped, set(['test1', 'test2', 'test3']))
     self.assertEqual(1, len(mock_sink_init.mock_calls))
     self.assertEqual(3, len(mock_report.mock_calls))
     self.assertEqual(1, len(mock_sink_close.mock_calls))
Exemple #2
0
 def test_add_test_names_status(self):
     """Tests add_test_names_status."""
     test_names = ['test1', 'test2', 'test3']
     collection = ResultCollection(test_results=[PASSED_RESULT])
     collection.add_test_names_status(test_names, TestStatus.SKIP)
     disabled_test_names = ['test4', 'test5', 'test6']
     collection.add_test_names_status(disabled_test_names,
                                      TestStatus.SKIP,
                                      expected_status=TestStatus.SKIP)
     self.assertEqual(collection.test_results[0], PASSED_RESULT)
     unexpected_skipped = collection.tests_by_expression(
         lambda t: not t.expected() and t.status == TestStatus.SKIP)
     self.assertEqual(unexpected_skipped, set(['test1', 'test2', 'test3']))
     self.assertEqual(collection.disabled_tests(),
                      set(['test4', 'test5', 'test6']))