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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « appengine/chromium_rietveld/templates/patchset.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2016 Google Inc.
3 #
4 # Licensed under the Apache License, Version 2.0 (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
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 """Tests for utils."""
17
18 import unittest
19
20 import setup
21 setup.process_args()
22
23 from codereview import utils
24
25
26 class UtilsTest(unittest.TestCase):
27 def test_parse_cq_status_url_message_v2(self):
28 url = ('https://chromium-cq-status.appspot.com/v2/'
29 'patch-status/codereview.chromium.org/213/1')
30 msg = 'CQ is trying da patch. Follow status at\n' + url
31 self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1))
32 msg += '\n'
33 self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1))
34 msg = 'Dry run: ' + msg
35 self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1))
36
37 def test_parse_cq_status_url_message_v1(self):
38 url = 'https://chromium-cq-status.appspot.com/patch-status/213/1'
39 msg = 'CQ is trying da patch. Follow status at\n' + url
40 self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1))
41 msg += '\n'
42 self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1))
43 msg = 'Dry run: ' + msg
44 self.assertEqual(utils.parse_cq_status_url_message(msg), (url, 213, 1))
45
46 def test_parse_cq_status_url_message_fail(self):
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'
49 self.assertEqual(utils.parse_cq_status_url_message(msg), (None, None, None))
50
51
52 if __name__ == '__main__':
53 unittest.main()
OLDNEW
« 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