| OLD | NEW |
| 1 # Copyright (C) 2009 Google Inc. All rights reserved. | 1 # Copyright (C) 2009 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 import unittest | 29 import unittest |
| 30 | 30 |
| 31 from webkitpy.common.net.buildbot import BuildBot | 31 from webkitpy.common.net.buildbot import BuildBot |
| 32 from webkitpy.common.net.layouttestresults import LayoutTestResults | |
| 33 | 32 |
| 34 | 33 |
| 35 class BuilderTest(unittest.TestCase): | 34 class BuilderTest(unittest.TestCase): |
| 36 | 35 |
| 37 def setUp(self): | 36 def test_results_url_no_build_number(self): |
| 38 self.buildbot = BuildBot() | 37 self.assertEqual( |
| 38 BuildBot().results_url('Test Builder'), |
| 39 'https://storage.googleapis.com/chromium-layout-test-archives/Test_B
uilder/results/layout-test-results') |
| 39 | 40 |
| 40 def test_latest_layout_test_results(self): | 41 def test_results_url_with_build_number(self): |
| 41 builder = BuildBot().builder_with_name('WebKit Mac10.8 (dbg)') | 42 self.assertEqual( |
| 42 builder.fetch_layout_test_results = lambda _: LayoutTestResults(None) | 43 BuildBot().results_url('Test Builder', 10), |
| 43 self.assertTrue(builder.latest_layout_test_results()) | 44 'https://storage.googleapis.com/chromium-layout-test-archives/Test_B
uilder/10/layout-test-results') |
| 44 | 45 |
| 45 def test_results_url(self): | 46 def test_builder_results_url_base(self): |
| 46 builder = BuildBot().builder_with_name('WebKit Mac10.8 (dbg)') | |
| 47 self.assertEqual( | 47 self.assertEqual( |
| 48 builder.results_url(), | 48 BuildBot().builder_results_url_base('WebKit Mac10.8 (dbg)'), |
| 49 'https://storage.googleapis.com/chromium-layout-test-archives/WebKit
_Mac10_8__dbg_') | 49 'https://storage.googleapis.com/chromium-layout-test-archives/WebKit
_Mac10_8__dbg_') |
| 50 | 50 |
| 51 def test_accumulated_results_url(self): | 51 def test_accumulated_results_url(self): |
| 52 builder = BuildBot().builder_with_name('WebKit Mac10.8 (dbg)') | |
| 53 self.assertEqual( | 52 self.assertEqual( |
| 54 builder.latest_layout_test_results_url(), | 53 BuildBot().accumulated_results_url_base('WebKit Mac10.8 (dbg)'), |
| 55 'https://storage.googleapis.com/chromium-layout-test-archives/WebKit
_Mac10_8__dbg_/results/layout-test-results') | 54 'https://storage.googleapis.com/chromium-layout-test-archives/WebKit
_Mac10_8__dbg_/results/layout-test-results') |
| 56 | 55 |
| 57 | 56 def fetch_layout_test_results_with_no_responses(self): |
| 58 class BuildBotTest(unittest.TestCase): | |
| 59 | |
| 60 def test_builder_with_name(self): | |
| 61 buildbot = BuildBot() | 57 buildbot = BuildBot() |
| 62 | 58 buildbot._fetch_file_from_results = lambda: None |
| 63 builder = buildbot.builder_with_name('Test Builder') | 59 self.assertIsNone(buildbot.fetch_layout_test_results(buildbot.results_ur
l('Builder'))) |
| 64 self.assertEqual(builder.name(), 'Test Builder') | |
| 65 self.assertEqual(builder.results_url(), 'https://storage.googleapis.com/
chromium-layout-test-archives/Test_Builder') | |
| 66 | |
| 67 build = builder.build(10) | |
| 68 self.assertEqual(build.builder(), builder) | |
| 69 self.assertEqual( | |
| 70 build.results_url(), | |
| 71 'https://storage.googleapis.com/chromium-layout-test-archives/Test_B
uilder/10/layout-test-results') | |
| OLD | NEW |