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 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 def test_changed_files(self): | 87 def test_changed_files(self): |
88 rietveld = Rietveld(self.mock_web()) | 88 rietveld = Rietveld(self.mock_web()) |
89 self.assertEqual( | 89 self.assertEqual( |
90 rietveld.changed_files(11112222), | 90 rietveld.changed_files(11112222), |
91 ['some/path/bar.html', 'some/path/foo.cc']) | 91 ['some/path/bar.html', 'some/path/foo.cc']) |
92 | 92 |
93 def test_changed_files_no_results(self): | 93 def test_changed_files_no_results(self): |
94 rietveld = Rietveld(self.mock_web()) | 94 rietveld = Rietveld(self.mock_web()) |
95 self.assertIsNone(rietveld.changed_files(11113333)) | 95 self.assertIsNone(rietveld.changed_files(11113333)) |
96 | |
97 # Testing protected methods - pylint: disable=protected-access | |
98 | |
99 def test_filter_latest_jobs_empty(self): | |
100 rietveld = Rietveld(self.mock_web()) | |
101 self.assertEqual(rietveld._filter_latest_builds([]), []) | |
102 | |
103 def test_filter_latest_jobs_higher_build_first(self): | |
104 rietveld = Rietveld(self.mock_web()) | |
105 self.assertEqual( | |
106 rietveld._filter_latest_builds([Build('foo', 5), Build('foo', 3), Bu
ild('bar', 5)]), | |
107 [Build('bar', 5), Build('foo', 5)]) | |
108 | |
109 def test_filter_latest_jobs_higher_build_last(self): | |
110 rietveld = Rietveld(self.mock_web()) | |
111 self.assertEqual( | |
112 rietveld._filter_latest_builds([Build('foo', 3), Build('bar', 5), Bu
ild('foo', 5)]), | |
113 [Build('bar', 5), Build('foo', 5)]) | |
114 | |
115 def test_filter_latest_jobs_no_build_number(self): | |
116 rietveld = Rietveld(self.mock_web()) | |
117 self.assertEqual( | |
118 rietveld._filter_latest_builds([Build('foo', 3), Build('bar'), Build
('bar')]), | |
119 [Build('bar'), Build('foo', 3)]) | |
OLD | NEW |