| 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 gcl.py.""" | 6 """Unit tests for gcl.py.""" |
| 7 | 7 |
| 8 # Local imports | 8 # Local imports |
| 9 import gcl | 9 import gcl |
| 10 from super_mox import mox, SuperMoxTestBase | 10 from super_mox import mox, SuperMoxTestBase |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 gcl.SVN.CaptureInfo("/bleh/prout", print_error=False).AndReturn(result) | 68 gcl.SVN.CaptureInfo("/bleh/prout", print_error=False).AndReturn(result) |
| 69 self.mox.ReplayAll() | 69 self.mox.ReplayAll() |
| 70 self.assertRaises(Exception, gcl.GetRepositoryRoot) | 70 self.assertRaises(Exception, gcl.GetRepositoryRoot) |
| 71 | 71 |
| 72 def testGetRepositoryRootGood(self): | 72 def testGetRepositoryRootGood(self): |
| 73 gcl.REPOSITORY_ROOT = None | 73 gcl.REPOSITORY_ROOT = None |
| 74 root_path = gcl.os.path.join('bleh', 'prout', 'pouet') | 74 root_path = gcl.os.path.join('bleh', 'prout', 'pouet') |
| 75 gcl.os.getcwd().AndReturn(root_path) | 75 gcl.os.getcwd().AndReturn(root_path) |
| 76 result1 = { "Repository Root": "Some root" } | 76 result1 = { "Repository Root": "Some root" } |
| 77 gcl.SVN.CaptureInfo(root_path, print_error=False).AndReturn(result1) | 77 gcl.SVN.CaptureInfo(root_path, print_error=False).AndReturn(result1) |
| 78 gcl.os.getcwd().AndReturn(root_path) | |
| 79 results2 = { "Repository Root": "A different root" } | 78 results2 = { "Repository Root": "A different root" } |
| 80 gcl.SVN.CaptureInfo(gcl.os.path.dirname(root_path), | 79 gcl.SVN.CaptureInfo(gcl.os.path.dirname(root_path), |
| 81 print_error=False).AndReturn(results2) | 80 print_error=False).AndReturn(results2) |
| 82 self.mox.ReplayAll() | 81 self.mox.ReplayAll() |
| 83 self.assertEquals(gcl.GetRepositoryRoot(), root_path) | 82 self.assertEquals(gcl.GetRepositoryRoot(), root_path) |
| 84 | 83 |
| 85 def testGetCachedFile(self): | 84 def testGetCachedFile(self): |
| 86 # TODO(maruel): TEST ME | 85 # TODO(maruel): TEST ME |
| 87 pass | 86 pass |
| 88 | 87 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 self.mox.ReplayAll() | 351 self.mox.ReplayAll() |
| 353 | 352 |
| 354 gcl.UploadCL(change_info, args) | 353 gcl.UploadCL(change_info, args) |
| 355 self.assertEquals(change_info.issue, 1) | 354 self.assertEquals(change_info.issue, 1) |
| 356 self.assertEquals(change_info.patchset, 2) | 355 self.assertEquals(change_info.patchset, 2) |
| 357 | 356 |
| 358 | 357 |
| 359 if __name__ == '__main__': | 358 if __name__ == '__main__': |
| 360 import unittest | 359 import unittest |
| 361 unittest.main() | 360 unittest.main() |
| OLD | NEW |