| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2009 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 import optparse |
| 9 | 9 |
| 10 # Local imports | 10 # Local imports |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 def testMembersChanged(self): | 76 def testMembersChanged(self): |
| 77 members = [ | 77 members = [ |
| 78 'GetBots', 'GetFileNames', 'GetLocalRoot', | 78 'GetBots', 'GetFileNames', 'GetLocalRoot', |
| 79 ] | 79 ] |
| 80 # If this test fails, you should add the relevant test. | 80 # If this test fails, you should add the relevant test. |
| 81 self.compareMembers(trychange.GIT, members) | 81 self.compareMembers(trychange.GIT, members) |
| 82 | 82 |
| 83 def testBasic(self): | 83 def testBasic(self): |
| 84 trychange.os.getcwd().AndReturn(self.fake_root) | 84 trychange.os.getcwd().AndReturn(self.fake_root) |
| 85 trychange.scm.GIT.GetCheckoutRoot(self.fake_root).AndReturn(self.fake_root) | 85 trychange.scm.GIT.GetCheckoutRoot(self.fake_root).AndReturn(self.fake_root) |
| 86 trychange.scm.GIT.GenerateDiff(self.fake_root).AndReturn('a diff') | 86 trychange.scm.GIT.GenerateDiff(self.fake_root, |
| 87 full_move=True).AndReturn('a diff') |
| 87 trychange.scm.GIT.GetPatchName(self.fake_root).AndReturn('bleh-1233') | 88 trychange.scm.GIT.GetPatchName(self.fake_root).AndReturn('bleh-1233') |
| 88 trychange.scm.GIT.GetEmail(self.fake_root).AndReturn('georges@example.com') | 89 trychange.scm.GIT.GetEmail(self.fake_root).AndReturn('georges@example.com') |
| 89 self.mox.ReplayAll() | 90 self.mox.ReplayAll() |
| 90 git = trychange.GIT(self.options) | 91 git = trychange.GIT(self.options) |
| 91 self.assertEqual(git.GetFileNames(), self.expected_files) | 92 self.assertEqual(git.GetFileNames(), self.expected_files) |
| 92 self.assertEqual(git.GetLocalRoot(), self.fake_root) | 93 self.assertEqual(git.GetLocalRoot(), self.fake_root) |
| 93 | 94 |
| 94 | 95 |
| 95 if __name__ == '__main__': | 96 if __name__ == '__main__': |
| 96 import unittest | 97 import unittest |
| 97 unittest.main() | 98 unittest.main() |
| OLD | NEW |