OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """Unit tests for the fetch_builds module.""" | 5 """Unit tests for the fetch_builds module.""" |
6 | 6 |
7 import errno | 7 import errno |
8 import unittest | 8 import unittest |
9 | 9 |
10 # The third-party mock module is expected to be available in PYTHONPATH. | 10 # The third-party mock module is expected to be available in PYTHONPATH. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 def test_PerfBuildArchive_Mac_BuilderName(self): | 159 def test_PerfBuildArchive_Mac_BuilderName(self): |
160 archive = fetch_build.PerfBuildArchive() | 160 archive = fetch_build.PerfBuildArchive() |
161 archive._platform = 'mac' | 161 archive._platform = 'mac' |
162 self.assertEqual('mac_perf_bisect_builder', archive.GetBuilderName()) | 162 self.assertEqual('mac_perf_bisect_builder', archive.GetBuilderName()) |
163 | 163 |
164 def test_PerfBuildArchive_mac_BuildTime(self): | 164 def test_PerfBuildArchive_mac_BuildTime(self): |
165 archive = fetch_build.PerfBuildArchive() | 165 archive = fetch_build.PerfBuildArchive() |
166 archive._platform = 'mac' | 166 archive._platform = 'mac' |
167 self.assertEqual(14400, archive.GetBuilderBuildTime()) | 167 self.assertEqual(14400, archive.GetBuilderBuildTime()) |
168 | 168 |
| 169 def test_GetBuildBotUrl_Perf(self): |
| 170 self.assertEqual(fetch_build.PERF_TRY_SERVER_URL, |
| 171 fetch_build.GetBuildBotUrl(fetch_build.PERF_BUILDER)) |
| 172 |
| 173 def test_GetBuildBotUrl_full(self): |
| 174 self.assertEqual(fetch_build.LINUX_TRY_SERVER_URL, |
| 175 fetch_build.GetBuildBotUrl(fetch_build.FULL_BUILDER)) |
169 | 176 |
170 class UnzipTest(unittest.TestCase): | 177 class UnzipTest(unittest.TestCase): |
171 | 178 |
172 def setUp(self): | 179 def setUp(self): |
173 # Mocks of the os and bisect_utils modules are used in the methods below. | 180 # Mocks of the os and bisect_utils modules are used in the methods below. |
174 os_patcher = mock.patch('fetch_build.os') | 181 os_patcher = mock.patch('fetch_build.os') |
175 self.mock_os = os_patcher.start() | 182 self.mock_os = os_patcher.start() |
176 self.addCleanup(os_patcher.stop) | 183 self.addCleanup(os_patcher.stop) |
177 | 184 |
178 bisect_utils_patcher = mock.patch('fetch_build.bisect_utils') | 185 bisect_utils_patcher = mock.patch('fetch_build.bisect_utils') |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 @mock.patch('fetch_build.shutil') | 240 @mock.patch('fetch_build.shutil') |
234 def test_RemoveDirectoryTree(self, mock_shutil): | 241 def test_RemoveDirectoryTree(self, mock_shutil): |
235 # _RemoveDirectoryTree uses shutil.rmtree. | 242 # _RemoveDirectoryTree uses shutil.rmtree. |
236 fetch_build._RemoveDirectoryTree('some/path') | 243 fetch_build._RemoveDirectoryTree('some/path') |
237 mock_shutil.rmtree.assert_called_with('some/path') | 244 mock_shutil.rmtree.assert_called_with('some/path') |
238 | 245 |
239 | 246 |
240 if __name__ == '__main__': | 247 if __name__ == '__main__': |
241 unittest.main() | 248 unittest.main() |
242 | 249 |
OLD | NEW |