| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 os | 8 import os |
| 9 import sys | 9 import sys |
| 10 import unittest | 10 import unittest |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 """trychange.SVN tests.""" | 101 """trychange.SVN tests.""" |
| 102 def testMembersChanged(self): | 102 def testMembersChanged(self): |
| 103 members = [ | 103 members = [ |
| 104 'AutomagicalSettings', 'CaptureStatus', 'GetCodeReviewSetting', | 104 'AutomagicalSettings', 'CaptureStatus', 'GetCodeReviewSetting', |
| 105 'ReadRootFile', 'GenerateDiff', 'GetFileNames', 'files', 'file_tuples', | 105 'ReadRootFile', 'GenerateDiff', 'GetFileNames', 'files', 'file_tuples', |
| 106 ] | 106 ] |
| 107 # If this test fails, you should add the relevant test. | 107 # If this test fails, you should add the relevant test. |
| 108 self.compareMembers(trychange.SVN, members) | 108 self.compareMembers(trychange.SVN, members) |
| 109 | 109 |
| 110 def testBasic(self): | 110 def testBasic(self): |
| 111 # pylint: disable=E1103 |
| 111 trychange.os.path.abspath(self.fake_root).AndReturn(self.fake_root) | 112 trychange.os.path.abspath(self.fake_root).AndReturn(self.fake_root) |
| 112 trychange.scm.SVN.GetCheckoutRoot(self.fake_root).AndReturn(self.fake_root) | 113 trychange.scm.SVN.GetCheckoutRoot(self.fake_root).AndReturn(self.fake_root) |
| 113 trychange.scm.SVN.GenerateDiff(['foo.txt', 'bar.txt'], | 114 trychange.scm.SVN.GenerateDiff(['foo.txt', 'bar.txt'], |
| 114 self.fake_root, | 115 self.fake_root, |
| 115 full_move=True, | 116 full_move=True, |
| 116 revision=None).AndReturn('A diff') | 117 revision=None).AndReturn('A diff') |
| 117 trychange.scm.SVN.GetEmail(self.fake_root).AndReturn('georges@example.com') | 118 trychange.scm.SVN.GetEmail(self.fake_root).AndReturn('georges@example.com') |
| 118 self.mox.ReplayAll() | 119 self.mox.ReplayAll() |
| 119 svn = trychange.SVN(self.options, self.fake_root, self.options.files) | 120 svn = trychange.SVN(self.options, self.fake_root, self.options.files) |
| 120 self.assertEqual(svn.GetFileNames(), self.expected_files) | 121 self.assertEqual(svn.GetFileNames(), self.expected_files) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 145 trychange.scm.GIT.GetEmail(self.fake_root).AndReturn('georges@example.com') | 146 trychange.scm.GIT.GetEmail(self.fake_root).AndReturn('georges@example.com') |
| 146 self.mox.ReplayAll() | 147 self.mox.ReplayAll() |
| 147 git = trychange.GIT(self.options, self.fake_root, self.options.files) | 148 git = trychange.GIT(self.options, self.fake_root, self.options.files) |
| 148 self.assertEqual(git.GetFileNames(), self.expected_files) | 149 self.assertEqual(git.GetFileNames(), self.expected_files) |
| 149 self.assertEqual(git.checkout_root, self.fake_root) | 150 self.assertEqual(git.checkout_root, self.fake_root) |
| 150 self.assertEqual(git.GenerateDiff(), 'A diff') | 151 self.assertEqual(git.GenerateDiff(), 'A diff') |
| 151 | 152 |
| 152 | 153 |
| 153 if __name__ == '__main__': | 154 if __name__ == '__main__': |
| 154 unittest.main() | 155 unittest.main() |
| OLD | NEW |