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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/PRESUBMIT_test.py

Issue 2512563002: Add WPTEXPORT footer automatically in DepsUpdater and imported/PRESUBMIT (Closed)
Patch Set: Created 4 years, 1 month 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
(Empty)
1 # Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from PRESUBMIT import PostUploadHook
6 import unittest
7 # TODO: how to run the tests so this is imported correctly?
foolip 2016/11/17 09:59:14 TODO(jeffcarp)
8 # from PRESUBMIT_test_mocks import MockOutputApi # pylint: disable=F0401
qyearsley 2016/11/17 00:23:27 I think you'd have to add something to the effect
9
10
11 class PresubmitTest(unittest.TestCase):
12
13 def test_adds_WPTEXPORT_true_if_not_exists(self):
14 mock['description'] = 'mock description'
15 PostUploadHook(MockCL(), None, MockOutputAPI())
16 self.assertIn('WPTEXPORT=true', mock['description'])
17
18 def test_doesnt_add_WPTEXPORT_if_exists(self):
19 mock['description'] = 'mock description\nWPTEXPORT=false'
20 PostUploadHook(MockCL(), None, MockOutputAPI())
21 self.assertIn('WPTEXPORT=false', mock['description'])
22
23
24 # TODO: Couldn't figure out how to mock this without using a global variable
qyearsley 2016/11/17 00:23:27 How about making the MockCL constructor take a des
25 mock = { 'description': '' }
26
27
28 class MockCL(object):
29 # TODO(jeffcarp): add to PRESUBMIT_test_mocks
30
31 def __init__(self):
32 self.issue = 'mock issue'
33
34 class RpcServer(object):
35
36 def get_description(self, _issue):
37 return mock['description']
38
39 def update_description(self, _issue, description):
40 mock['description'] = description
41
42
43 class MockOutputAPI():
44
45 def PresubmitNotifyResult(self, description):
46 return description
47
48
49 if __name__ == '__main__':
50 unittest.main()
51
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698