def testappend_crash_message(self): """Tests append_crash_message.""" collection = ResultCollection(test_results=[PASSED_RESULT]) collection.append_crash_message('Crash message 1.') self.assertEqual(collection.crash_message, 'Crash message 1.') collection.append_crash_message('Crash message 2.') self.assertEqual(collection.crash_message, 'Crash message 1.\nCrash message 2.')
def test_add_result_collection_ignore(self): """Tests add_result_collection overwrite.""" collection = ResultCollection(test_results=[FAILED_RESULT]) self.assertFalse(collection.crashed) crashed_collection = ResultCollection(test_results=[PASSED_RESULT], crashed=True) crashed_collection.append_crash_message('Crash2') collection.add_result_collection(crashed_collection, ignore_crash=True) self.assertFalse(collection.crashed) self.assertEqual(collection.crash_message, '') self.assertEqual(collection.test_results, [FAILED_RESULT, PASSED_RESULT])
def test_add_result_collection_default(self): """Tests add_result_collection default (merge crash info).""" collection = ResultCollection(test_results=[FAILED_RESULT]) self.assertFalse(collection.crashed) collection.append_crash_message('Crash1') crashed_collection = ResultCollection(test_results=[PASSED_RESULT], crashed=True) crashed_collection.append_crash_message('Crash2') collection.add_result_collection(crashed_collection) self.assertTrue(collection.crashed) self.assertEqual(collection.crash_message, 'Crash1\nCrash2') self.assertEqual(collection.test_results, [FAILED_RESULT, PASSED_RESULT])