OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import json | 5 import json |
6 import urllib2 | 6 import urllib2 |
7 | 7 |
8 from webkitpy.common.net.rietveld import Rietveld | 8 from webkitpy.common.net.rietveld import Rietveld |
9 from webkitpy.common.net.buildbot import Build | 9 from webkitpy.common.net.buildbot import Build |
10 from webkitpy.common.net.web_mock import MockWeb | 10 from webkitpy.common.net.web_mock import MockWeb |
11 from webkitpy.common.system.logtesting import LoggingTestCase | 11 from webkitpy.common.system.log_testing import LoggingTestCase |
12 | 12 |
13 | 13 |
14 class RietveldTest(LoggingTestCase): | 14 class RietveldTest(LoggingTestCase): |
15 | 15 |
16 def mock_web(self): | 16 def mock_web(self): |
17 return MockWeb(urls={ | 17 return MockWeb(urls={ |
18 'https://codereview.chromium.org/api/11112222': json.dumps({ | 18 'https://codereview.chromium.org/api/11112222': json.dumps({ |
19 'patchsets': [1, 2, 3], | 19 'patchsets': [1, 2, 3], |
20 }), | 20 }), |
21 'https://codereview.chromium.org/api/11112222/2': json.dumps({ | 21 'https://codereview.chromium.org/api/11112222/2': json.dumps({ |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 rietveld = Rietveld(self.mock_web()) | 110 rietveld = Rietveld(self.mock_web()) |
111 self.assertEqual( | 111 self.assertEqual( |
112 rietveld._filter_latest_builds([Build('foo', 3), Build('bar', 5), Bu
ild('foo', 5)]), | 112 rietveld._filter_latest_builds([Build('foo', 3), Build('bar', 5), Bu
ild('foo', 5)]), |
113 [Build('bar', 5), Build('foo', 5)]) | 113 [Build('bar', 5), Build('foo', 5)]) |
114 | 114 |
115 def test_filter_latest_jobs_no_build_number(self): | 115 def test_filter_latest_jobs_no_build_number(self): |
116 rietveld = Rietveld(self.mock_web()) | 116 rietveld = Rietveld(self.mock_web()) |
117 self.assertEqual( | 117 self.assertEqual( |
118 rietveld._filter_latest_builds([Build('foo', 3), Build('bar'), Build
('bar')]), | 118 rietveld._filter_latest_builds([Build('foo', 3), Build('bar'), Build
('bar')]), |
119 [Build('bar'), Build('foo', 3)]) | 119 [Build('bar'), Build('foo', 3)]) |
OLD | NEW |