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

Side by Side Diff: tests/trychange_unittest.py

Issue 562031: Fix licensing headers and move most third party code to third_party/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 10 years, 10 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 | Annotate | Revision Log
Property Changes:
Added: svn:executable
+ *
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for trychange.py.""" 6 """Unit tests for trychange.py."""
7 7
8 import optparse 8 # Fixes include path.
9 from super_mox import mox, SuperMoxTestBase
9 10
10 # Local imports
11 import trychange 11 import trychange
12 from super_mox import mox, SuperMoxTestBase
13 12
14 13
15 class TryChangeTestsBase(SuperMoxTestBase): 14 class TryChangeTestsBase(SuperMoxTestBase):
16 """Setups and tear downs the mocks but doesn't test anything as-is.""" 15 """Setups and tear downs the mocks but doesn't test anything as-is."""
17 def setUp(self): 16 def setUp(self):
18 SuperMoxTestBase.setUp(self) 17 SuperMoxTestBase.setUp(self)
19 self.mox.StubOutWithMock(trychange.gclient_utils, 'CheckCall') 18 self.mox.StubOutWithMock(trychange.gclient_utils, 'CheckCall')
20 self.mox.StubOutWithMock(trychange.scm.GIT, 'Capture') 19 self.mox.StubOutWithMock(trychange.scm.GIT, 'Capture')
21 self.mox.StubOutWithMock(trychange.scm.GIT, 'GenerateDiff') 20 self.mox.StubOutWithMock(trychange.scm.GIT, 'GenerateDiff')
22 self.mox.StubOutWithMock(trychange.scm.GIT, 'GetCheckoutRoot') 21 self.mox.StubOutWithMock(trychange.scm.GIT, 'GetCheckoutRoot')
23 self.mox.StubOutWithMock(trychange.scm.GIT, 'GetPatchName') 22 self.mox.StubOutWithMock(trychange.scm.GIT, 'GetPatchName')
24 self.mox.StubOutWithMock(trychange.scm.GIT, 'GetEmail') 23 self.mox.StubOutWithMock(trychange.scm.GIT, 'GetEmail')
25 self.mox.StubOutWithMock(trychange.scm.SVN, 'DiffItem') 24 self.mox.StubOutWithMock(trychange.scm.SVN, 'DiffItem')
26 self.mox.StubOutWithMock(trychange.scm.SVN, 'GenerateDiff') 25 self.mox.StubOutWithMock(trychange.scm.SVN, 'GenerateDiff')
27 self.mox.StubOutWithMock(trychange.scm.SVN, 'GetCheckoutRoot') 26 self.mox.StubOutWithMock(trychange.scm.SVN, 'GetCheckoutRoot')
28 self.mox.StubOutWithMock(trychange.scm.SVN, 'GetEmail') 27 self.mox.StubOutWithMock(trychange.scm.SVN, 'GetEmail')
29 self.fake_root = self.Dir() 28 self.fake_root = self.Dir()
30 self.expected_files = ['foo.txt', 'bar.txt'] 29 self.expected_files = ['foo.txt', 'bar.txt']
31 self.options = optparse.Values() 30 self.options = trychange.optparse.Values()
32 self.options.files = self.expected_files 31 self.options.files = self.expected_files
33 self.options.diff = None 32 self.options.diff = None
34 self.options.name = None 33 self.options.name = None
35 self.options.email = None 34 self.options.email = None
36 self.options.exclude = [] 35 self.options.exclude = []
37 36
38 37
39 class TryChangeUnittest(TryChangeTestsBase): 38 class TryChangeUnittest(TryChangeTestsBase):
40 """General trychange.py tests.""" 39 """General trychange.py tests."""
41 def testMembersChanged(self): 40 def testMembersChanged(self):
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 self.mox.ReplayAll() 97 self.mox.ReplayAll()
99 git = trychange.GIT(self.options, self.fake_root) 98 git = trychange.GIT(self.options, self.fake_root)
100 self.assertEqual(git.GetFileNames(), self.expected_files) 99 self.assertEqual(git.GetFileNames(), self.expected_files)
101 self.assertEqual(git.checkout_root, self.fake_root) 100 self.assertEqual(git.checkout_root, self.fake_root)
102 self.assertEqual(git.GenerateDiff(), 'A diff') 101 self.assertEqual(git.GenerateDiff(), 'A diff')
103 102
104 103
105 if __name__ == '__main__': 104 if __name__ == '__main__':
106 import unittest 105 import unittest
107 unittest.main() 106 unittest.main()
OLDNEW
« tests/gclient_scm_test.py ('K') | « tests/super_mox.py ('k') | third_party/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698