| 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.common.host_mock import MockHost | 7 from webkitpy.common.host_mock import MockHost |
| 8 from webkitpy.common.system.executive_mock import MockExecutive | 8 from webkitpy.common.system.executive_mock import MockExecutive |
| 9 from webkitpy.w3c.test_importer import TestImporter | 9 from webkitpy.w3c.test_importer import TestImporter |
| 10 | 10 |
| 11 | 11 |
| 12 class TestImporterTest(unittest.TestCase): | 12 class TestImporterTest(unittest.TestCase): |
| 13 | 13 |
| 14 def test_generate_email_list(self): | |
| 15 importer = TestImporter(MockHost()) | |
| 16 changed_files = [ | |
| 17 'third_party/WebKit/LayoutTests/foo/bar/file.html', | |
| 18 'third_party/WebKit/LayoutTests/foo/bar/otherfile.html', | |
| 19 'third_party/WebKit/LayoutTests/foo/baz/files.html', | |
| 20 'some/non-test.file', | |
| 21 ] | |
| 22 directory_to_owner = { | |
| 23 'foo/bar': 'someone@gmail.com', | |
| 24 'foo/baz': 'not an email address', | |
| 25 'foo/bat': 'noone@gmail.com', | |
| 26 } | |
| 27 self.assertEqual( | |
| 28 importer.generate_email_list(changed_files, directory_to_owner), | |
| 29 ['someone@gmail.com']) | |
| 30 | |
| 31 def test_parse_directory_owners(self): | |
| 32 importer = TestImporter(MockHost()) | |
| 33 data_file = [ | |
| 34 {'notification-email': 'charizard@gmail.com', 'directory': 'foo/bar'
}, | |
| 35 {'notification-email': 'blastoise@gmail.com', 'directory': 'foo/baz'
}, | |
| 36 {'notification-email': '', 'directory': 'gol/bat'}, | |
| 37 ] | |
| 38 self.assertEqual( | |
| 39 importer.parse_directory_owners(data_file), | |
| 40 {'foo/bar': 'charizard@gmail.com', 'foo/baz': 'blastoise@gmail.com'}
) | |
| 41 | |
| 42 def test_update_test_expectations(self): | 14 def test_update_test_expectations(self): |
| 43 host = MockHost() | 15 host = MockHost() |
| 44 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Tes
tExpectations'] = ( | 16 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Tes
tExpectations'] = ( |
| 45 'Bug(test) some/test/a.html [ Failure ]\n' | 17 'Bug(test) some/test/a.html [ Failure ]\n' |
| 46 'Bug(test) some/test/b.html [ Failure ]\n' | 18 'Bug(test) some/test/b.html [ Failure ]\n' |
| 47 'Bug(test) some/test/c.html [ Failure ]\n') | 19 'Bug(test) some/test/c.html [ Failure ]\n') |
| 48 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Vir
tualTestSuites'] = '[]' | 20 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Vir
tualTestSuites'] = '[]' |
| 49 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/new
/a.html'] = '' | 21 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/new
/a.html'] = '' |
| 50 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/new
/b.html'] = '' | 22 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/new
/b.html'] = '' |
| 51 importer = TestImporter(host) | 23 importer = TestImporter(host) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 '--work', | 114 '--work', |
| 143 '--tests-root', | 115 '--tests-root', |
| 144 '/mock-checkout/third_party/WebKit/LayoutTests/external/wpt' | 116 '/mock-checkout/third_party/WebKit/LayoutTests/external/wpt' |
| 145 ], | 117 ], |
| 146 [ | 118 [ |
| 147 'git', | 119 'git', |
| 148 'add', | 120 'add', |
| 149 '/mock-checkout/third_party/WebKit/LayoutTests/external/wpt/
MANIFEST.json' | 121 '/mock-checkout/third_party/WebKit/LayoutTests/external/wpt/
MANIFEST.json' |
| 150 ] | 122 ] |
| 151 ]) | 123 ]) |
| OLD | NEW |