| 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.executive_mock import MockExecutive2 |
| 10 | 10 |
| 11 | 11 |
| 12 class DepsUpdaterTest(unittest.TestCase): | 12 class DepsUpdaterTest(unittest.TestCase): |
| 13 | 13 |
| 14 def test_generate_email_list(self): | 14 def test_generate_email_list(self): |
| 15 updater = DepsUpdater(MockHost()) | 15 updater = DepsUpdater(MockHost()) |
| 16 changed_files = [ | 16 changed_files = [ |
| 17 'third_party/WebKit/LayoutTests/foo/bar/file.html', | 17 'third_party/WebKit/LayoutTests/foo/bar/file.html', |
| 18 'third_party/WebKit/LayoutTests/foo/bar/otherfile.html', | 18 'third_party/WebKit/LayoutTests/foo/bar/otherfile.html', |
| 19 'third_party/WebKit/LayoutTests/foo/baz/files.html', | 19 'third_party/WebKit/LayoutTests/foo/baz/files.html', |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 deleted_tests = ['some/test/b.html'] | 52 deleted_tests = ['some/test/b.html'] |
| 53 renamed_test_pairs = { | 53 renamed_test_pairs = { |
| 54 'some/test/a.html': 'new/a.html', | 54 'some/test/a.html': 'new/a.html', |
| 55 'some/test/c.html': 'new/c.html', | 55 'some/test/c.html': 'new/c.html', |
| 56 } | 56 } |
| 57 updater.update_all_test_expectations_files(deleted_tests, renamed_test_p
airs) | 57 updater.update_all_test_expectations_files(deleted_tests, renamed_test_p
airs) |
| 58 self.assertMultiLineEqual( | 58 self.assertMultiLineEqual( |
| 59 host.filesystem.read_text_file('/mock-checkout/third_party/WebKit/La
youtTests/TestExpectations'), | 59 host.filesystem.read_text_file('/mock-checkout/third_party/WebKit/La
youtTests/TestExpectations'), |
| 60 ('Bug(test) new/a.html [ Failure ]\n' | 60 ('Bug(test) new/a.html [ Failure ]\n' |
| 61 'Bug(test) new/c.html [ Failure ]\n')) | 61 'Bug(test) new/c.html [ Failure ]\n')) |
| 62 |
| 63 # Tests for protected methods - pylint: disable=protected-access |
| 64 |
| 65 def test_cl_description_with_empty_environ(self): |
| 66 host = MockHost() |
| 67 host.executive = MockExecutive2(output='Last commit message\n') |
| 68 updater = DepsUpdater(host) |
| 69 description = updater._cl_description() |
| 70 self.assertEqual( |
| 71 description, |
| 72 ('Last commit message\n' |
| 73 'TBR=qyearsley@chromium.org')) |
| 74 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=%
B']]) |
| 75 |
| 76 def test_cl_description_with_environ_variables(self): |
| 77 host = MockHost() |
| 78 host.executive = MockExecutive2(output='Last commit message\n') |
| 79 updater = DepsUpdater(host) |
| 80 updater.host.environ['BUILDBOT_MASTERNAME'] = 'my.master' |
| 81 updater.host.environ['BUILDBOT_BUILDERNAME'] = 'b' |
| 82 updater.host.environ['BUILDBOT_BUILDNUMBER'] = '123' |
| 83 description = updater._cl_description() |
| 84 self.assertEqual( |
| 85 description, |
| 86 ('Last commit message\n' |
| 87 'Build: https://build.chromium.org/p/my.master/builders/b/builds/12
3\n\n' |
| 88 'TBR=qyearsley@chromium.org')) |
| 89 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=%
B']]) |
| OLD | NEW |