Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(887)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/deps_updater_unittest.py

Issue 2605873004: Unify MockExecutive and MockExecutive2. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
8 from webkitpy.common.system.executive_mock import MockExecutive
7 from webkitpy.w3c.deps_updater import DepsUpdater 9 from webkitpy.w3c.deps_updater import DepsUpdater
8 from webkitpy.common.host_mock import MockHost
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 62
63 # Tests for protected methods - pylint: disable=protected-access 63 # Tests for protected methods - pylint: disable=protected-access
64 64
65 def test_cl_description_with_empty_environ(self): 65 def test_cl_description_with_empty_environ(self):
66 host = MockHost() 66 host = MockHost()
67 host.executive = MockExecutive2(output='Last commit message\n') 67 host.executive = MockExecutive(output='Last commit message\n')
68 updater = DepsUpdater(host) 68 updater = DepsUpdater(host)
69 description = updater._cl_description() 69 description = updater._cl_description()
70 self.assertEqual( 70 self.assertEqual(
71 description, 71 description,
72 ('Last commit message\n' 72 ('Last commit message\n'
73 'TBR=qyearsley@chromium.org\n' 73 'TBR=qyearsley@chromium.org\n'
74 'NOEXPORT=true')) 74 'NOEXPORT=true'))
75 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=% B']]) 75 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=% B']])
76 76
77 def test_cl_description_with_environ_variables(self): 77 def test_cl_description_with_environ_variables(self):
78 host = MockHost() 78 host = MockHost()
79 host.executive = MockExecutive2(output='Last commit message\n') 79 host.executive = MockExecutive(output='Last commit message\n')
80 updater = DepsUpdater(host) 80 updater = DepsUpdater(host)
81 updater.host.environ['BUILDBOT_MASTERNAME'] = 'my.master' 81 updater.host.environ['BUILDBOT_MASTERNAME'] = 'my.master'
82 updater.host.environ['BUILDBOT_BUILDERNAME'] = 'b' 82 updater.host.environ['BUILDBOT_BUILDERNAME'] = 'b'
83 updater.host.environ['BUILDBOT_BUILDNUMBER'] = '123' 83 updater.host.environ['BUILDBOT_BUILDNUMBER'] = '123'
84 description = updater._cl_description() 84 description = updater._cl_description()
85 self.assertEqual( 85 self.assertEqual(
86 description, 86 description,
87 ('Last commit message\n' 87 ('Last commit message\n'
88 'Build: https://build.chromium.org/p/my.master/builders/b/builds/12 3\n\n' 88 'Build: https://build.chromium.org/p/my.master/builders/b/builds/12 3\n\n'
89 'TBR=qyearsley@chromium.org\n' 89 'TBR=qyearsley@chromium.org\n'
90 'NOEXPORT=true')) 90 'NOEXPORT=true'))
91 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=% B']]) 91 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=% B']])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698