Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6874)

Unified Diff: appengine/chromium_rietveld/tests/test_utils.py

Issue 2123093009: Rietveld: add CQ status URL instead of comment. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/chromium_rietveld/templates/patchset.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/chromium_rietveld/tests/test_utils.py
diff --git a/appengine/chromium_rietveld/tests/test_utils.py b/appengine/chromium_rietveld/tests/test_utils.py
new file mode 100755
index 0000000000000000000000000000000000000000..aa7dfb4c458ae56ccb344d78017eaf75628ba6b2
--- /dev/null
+++ b/appengine/chromium_rietveld/tests/test_utils.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+# Copyright 2016 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Tests for utils."""
+
+import unittest
+
+import setup
+setup.process_args()
+
+from codereview import utils
+
+
+class UtilsTest(unittest.TestCase):
+ def test_parse_cq_status_url_message_v2(self):
+ url = ('https://chromium-cq-status.appspot.com/v2/'
+ 'patch-status/codereview.chromium.org/213/1')
+ msg = 'CQ is trying da patch. Follow status at\n' + url
+ self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1))
+ msg += '\n'
+ self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1))
+ msg = 'Dry run: ' + msg
+ self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1))
+
+ def test_parse_cq_status_url_message_v1(self):
+ url = 'https://chromium-cq-status.appspot.com/patch-status/213/1'
+ msg = 'CQ is trying da patch. Follow status at\n' + url
+ self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1))
+ msg += '\n'
+ self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1))
+ msg = 'Dry run: ' + msg
+ self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1))
+
+ def test_parse_cq_status_url_message_fail(self):
+ self.assertEqual(utils.parse_cq_status_url_message(''), (None, None, None))
+ msg = 'Dry run failed because https://weird.url/patch-status/123/4'
+ self.assertEqual(utils.parse_cq_status_url_message(msg), (None, None, None))
+
+
+if __name__ == '__main__':
+ unittest.main()
« no previous file with comments | « appengine/chromium_rietveld/templates/patchset.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698