Chromium Code Reviews| 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 unittest | 5 import unittest |
| 6 | 6 |
| 7 from webkitpy.w3c.deps_updater import DepsUpdater | 7 from webkitpy.w3c.deps_updater import DepsUpdater |
| 8 from webkitpy.common.host_mock import MockHost | 8 from webkitpy.common.host_mock import MockHost |
| 9 from webkitpy.common.system.filesystem_mock import MockFileSystem | 9 from webkitpy.common.system.filesystem_mock import MockFileSystem |
| 10 from webkitpy.w3c.deps_updater import parse_directory_owners | |
| 10 | 11 |
| 11 | 12 |
| 12 class DepsUpdaterTest(unittest.TestCase): | 13 class DepsUpdaterTest(unittest.TestCase): |
| 13 | 14 |
| 14 def test_parse_try_job_results(self): | 15 def test_parse_try_job_results(self): |
| 15 output = """Successes: | 16 output = """Successes: |
| 16 linux_builder http://example.com/linux_builder/builds/222 | 17 linux_builder http://example.com/linux_builder/builds/222 |
| 17 mac_builder http://example.com/mac_builder/builds/222 | 18 mac_builder http://example.com/mac_builder/builds/222 |
| 18 win_builder http://example.com/win_builder/builds/222 | 19 win_builder http://example.com/win_builder/builds/222 |
| 19 Failures: | 20 Failures: |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 | 62 |
| 62 def test_is_manual_test_with_corresponding_automation_file(self): | 63 def test_is_manual_test_with_corresponding_automation_file(self): |
| 63 updater = DepsUpdater(MockHost()) | 64 updater = DepsUpdater(MockHost()) |
| 64 imported_dir = '/mock-checkout/third_party/WebKit/LayoutTests/imported/' | 65 imported_dir = '/mock-checkout/third_party/WebKit/LayoutTests/imported/' |
| 65 fs = MockFileSystem(files={ | 66 fs = MockFileSystem(files={ |
| 66 imported_dir + 'wpt_automation/a/x-manual-input.js': '', | 67 imported_dir + 'wpt_automation/a/x-manual-input.js': '', |
| 67 imported_dir + 'wpt_automation/a/y-manual-automation.js': '', | 68 imported_dir + 'wpt_automation/a/y-manual-automation.js': '', |
| 68 }) | 69 }) |
| 69 self.assertTrue(updater.is_manual_test(fs, imported_dir + 'wpt/a', 'x-ma nual.html')) | 70 self.assertTrue(updater.is_manual_test(fs, imported_dir + 'wpt/a', 'x-ma nual.html')) |
| 70 self.assertFalse(updater.is_manual_test(fs, imported_dir + 'wpt/a', 'y-m anual.html')) | 71 self.assertFalse(updater.is_manual_test(fs, imported_dir + 'wpt/a', 'y-m anual.html')) |
| 72 | |
| 73 def test_generate_email_list(self): | |
| 74 updater = DepsUpdater(MockHost()) | |
| 75 owners = {'foo/bar': 'me@gmail.com', 'foo/baz': 'you@gmail.com', 'foo/ba t': 'noone@gmail.com'} | |
| 76 results = 'foo/bar/file.html\nfoo/bar/otherfile.html\nfoo/baz/files.html ' | |
| 77 self.assertEqual(updater.generate_email_list(results, owners), ['me@gmai l.com', 'you@gmail.com']) | |
|
qyearsley
2016/07/28 23:46:33
Test will need to be updated, I think.
| |
| 78 | |
| 79 def test_parse_directory_owners(self): | |
| 80 data_file = [{'notification-email': 'charizard@gmail.com', 'directory': 'foo/bar'}, | |
| 81 {'notification-email': 'blastoise@gmail.com', 'directory': 'foo/baz'}, | |
| 82 {'notification-email': '', 'directory': 'gol/bat'}] | |
| 83 self.assertEqual(parse_directory_owners(data_file), | |
| 84 {'foo/bar': 'charizard@gmail.com', 'foo/baz': 'blastois e@gmail.com'}) | |
| OLD | NEW |