| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 Google Inc. | 2 # Copyright 2016 Google Inc. |
| 3 # | 3 # |
| 4 # Licensed under the Apache License, Version 2.0 (the "License"); | 4 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 # you may not use this file except in compliance with the License. | 5 # you may not use this file except in compliance with the License. |
| 6 # You may obtain a copy of the License at | 6 # You may obtain a copy of the License at |
| 7 # | 7 # |
| 8 # http://www.apache.org/licenses/LICENSE-2.0 | 8 # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 # | 9 # |
| 10 # Unless required by applicable law or agreed to in writing, software | 10 # Unless required by applicable law or agreed to in writing, software |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 msg += '\n' | 41 msg += '\n' |
| 42 self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1)) | 42 self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1)) |
| 43 msg = 'Dry run: ' + msg | 43 msg = 'Dry run: ' + msg |
| 44 self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1)) | 44 self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1)) |
| 45 | 45 |
| 46 def test_parse_cq_status_url_message_fail(self): | 46 def test_parse_cq_status_url_message_fail(self): |
| 47 self.assertEqual(utils.parse_cq_status_url_message(''), (None, None, None)) | 47 self.assertEqual(utils.parse_cq_status_url_message(''), (None, None, None)) |
| 48 msg = 'Dry run failed because https://weird.url/patch-status/123/4' | 48 msg = 'Dry run failed because https://weird.url/patch-status/123/4' |
| 49 self.assertEqual(utils.parse_cq_status_url_message(msg), (None, None, None)) | 49 self.assertEqual(utils.parse_cq_status_url_message(msg), (None, None, None)) |
| 50 | 50 |
| 51 def test_is_cq_dry_run_start_message(self): |
| 52 self.assertTrue(utils.is_cq_dry_run_start_message( |
| 53 'Dry Run: CQ is trying da patch. Follow status at\n\nhttps://u.r/l')) |
| 54 self.assertTrue(utils.is_cq_dry_run_start_message( |
| 55 'Dry Run: CQ is trying da patch.\nReference: codereview/xxxx/yyy')) |
| 56 |
| 57 self.assertFalse(utils.is_cq_dry_run_start_message( |
| 58 'CQ is trying da patch. Follow status at\n\nhttps://u.r/l')) |
| 59 self.assertFalse(utils.is_cq_dry_run_start_message( |
| 60 'Dry run: Try jobs failed...')) |
| 61 self.assertFalse(utils.is_cq_dry_run_start_message( |
| 62 'Try jobs failed because builder name is Dry Run...')) |
| 63 |
| 64 def test_is_cq_dry_message(self): |
| 65 self.assertTrue(utils.is_cq_dry_message('Dry run: Try jobs failed...')) |
| 66 self.assertFalse(utils.is_cq_dry_message( |
| 67 'Try jobs failed because builder name is Dry Run...')) |
| 68 |
| 51 | 69 |
| 52 if __name__ == '__main__': | 70 if __name__ == '__main__': |
| 53 unittest.main() | 71 unittest.main() |
| OLD | NEW |