def test_message_formatting(self): """ Test message formatter for different test cases. """ for i in range(len(TEST_CASES)): test_case = TEST_CASES[i] self._check_test_case_fields(test_case, i) f = GerritReviewMessageFormatter(header=test_case['header'], footer=test_case['footer']) for paragraph in test_case['paragraphs']: f.append(paragraph) m = f.format() self.assertEqual(m, test_case['result'], "Formatted message does not match expected " "result in test case #%d:\n[%s]" % (i, m))
def test_message_formatting(self): """ Test message formatter for different test cases. """ for i in range(len(TEST_CASES)): test_case = TEST_CASES[i] self._check_test_case_fields(test_case, i) f = GerritReviewMessageFormatter(header=test_case['header'], footer=test_case['footer']) for paragraph in test_case['paragraphs']: f.append(paragraph) m = f.format() self.assertEqual( m, test_case['result'], "Formatted message does not match expected " "result in test case #%d:\n[%s]" % (i, m))
def test_is_empty(self): """ Test if message is empty for missing header and footer. """ f = GerritReviewMessageFormatter(header=None, footer=None) self.assertTrue(f.is_empty()) f.append(['test']) self.assertFalse(f.is_empty())