Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_message_formatting(self):
"""Test message formatter for different test cases."""
for i, test_case in enumerate(TEST_CASES):
self._check_test_case_fields(test_case, i)
fmt = GerritReviewMessageFormatter(
header=test_case["header"], footer=test_case["footer"]
)
for paragraph in test_case["paragraphs"]:
fmt.append(paragraph)
msg = fmt.format()
self.assertEqual(
msg,
test_case["result"],
"Formatted message does not match expected "
"result in test case #%d:\n[%s]" % (i, msg),
)
def test_is_empty(self):
"""Test if message is empty for missing header and footer."""
fmt = GerritReviewMessageFormatter(header=None, footer=None)
self.assertTrue(fmt.is_empty())
fmt.append(["test"])
self.assertFalse(fmt.is_empty())