| """Tests for commit_message_utils.""" |
| import unittest |
| |
| from cq.scripts.helpers import commit_message_utils |
| |
| EXAMPLE_REVERT_COMMIT_MESSAGE = """ |
| Revert "Split AssistantService's implementation off CastService's" |
| |
| Revert the commit because it breaks Cast on AT. |
| |
| This reverts commit 9c2d5e2bb6d51a8ad6cb9b0fa9c5e867cc525d7a. |
| |
| Test: Cast boots again on Jasper on O |
| Bug: 110371959 |
| |
| Change-Id: I3fa23e842985bb673b60ea959b9bff3a484056f3 |
| """ |
| |
| EXAMPLE_NON_REVERT_COMMIT_MESSAGE = """ |
| Split AssistantService's implementation off CastService's |
| |
| Still uses v2 and then Mojo to talk to libassistant, both of which will |
| now be able to be removed. |
| |
| Bug: 109845832 |
| Test: For the moment only that it compiles (assistant enabled and not). |
| Change-Id: I22552ed2737d75c62947c8394fb0fab2cf17a013 |
| """ |
| |
| class CommitMessageUtilsTest(unittest.TestCase): |
| |
| def testTheCommitMessageThatPromptedChangeInClangFormatStep(self): |
| self.assertTrue(commit_message_utils.is_revert_commit_message( |
| EXAMPLE_REVERT_COMMIT_MESSAGE)) |
| |
| def testTheCommitMessageForTheChangeThatItWasReverting(self): |
| self.assertFalse(commit_message_utils.is_revert_commit_message( |
| EXAMPLE_NON_REVERT_COMMIT_MESSAGE)) |
| |
| |
| if __name__ == '__main__': |
| unittest.main() |