| OLD | NEW | 
|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python | 
| 2 # | 2 # | 
| 3 # Copyright 2008-2009 Google Inc.  All Rights Reserved. | 3 # Copyright 2008-2009 Google Inc.  All Rights Reserved. | 
| 4 # | 4 # | 
| 5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); | 
| 6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. | 
| 7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at | 
| 8 # | 8 # | 
| 9 #      http://www.apache.org/licenses/LICENSE-2.0 | 9 #      http://www.apache.org/licenses/LICENSE-2.0 | 
| 10 # | 10 # | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 70 class BaseTestCase(unittest.TestCase): | 70 class BaseTestCase(unittest.TestCase): | 
| 71   # Like unittest's assertRaises, but checks for Gclient.Error. | 71   # Like unittest's assertRaises, but checks for Gclient.Error. | 
| 72   def assertRaisesError(self, msg, fn, *args, **kwargs): | 72   def assertRaisesError(self, msg, fn, *args, **kwargs): | 
| 73     try: | 73     try: | 
| 74       fn(*args, **kwargs) | 74       fn(*args, **kwargs) | 
| 75     except gclient.Error, e: | 75     except gclient.Error, e: | 
| 76       self.assertEquals(e.args[0], msg) | 76       self.assertEquals(e.args[0], msg) | 
| 77     else: | 77     else: | 
| 78       self.fail('%s not raised' % msg) | 78       self.fail('%s not raised' % msg) | 
| 79 | 79 | 
| 80   def compareMembers(self, object, members): |  | 
| 81     """If you add a member, be sure to add the relevant test!""" |  | 
| 82     # Skip over members starting with '_' since they are usually not meant to |  | 
| 83     # be for public use. |  | 
| 84     actual_members = [x for x in sorted(dir(object)) |  | 
| 85                       if not x.startswith('_')] |  | 
| 86     expected_members = sorted(members) |  | 
| 87     if actual_members != expected_members: |  | 
| 88       diff = ([i for i in actual_members if i not in expected_members] + |  | 
| 89               [i for i in expected_members if i not in actual_members]) |  | 
| 90       print diff |  | 
| 91     self.assertEqual(actual_members, expected_members) |  | 
| 92 |  | 
| 93 |  | 
| 94 class GClientBaseTestCase(BaseTestCase): |  | 
| 95   def Options(self, *args, **kwargs): | 80   def Options(self, *args, **kwargs): | 
| 96     return self.OptionsObject(self, *args, **kwargs) | 81     return self.OptionsObject(self, *args, **kwargs) | 
| 97 | 82 | 
| 98   def setUp(self): | 83   def setUp(self): | 
| 99     self.mox = mox.Mox() | 84     self.mox = mox.Mox() | 
| 100     # Mock them to be sure nothing bad happens. | 85     # Mock them to be sure nothing bad happens. | 
| 101     self._CaptureSVN = gclient.CaptureSVN | 86     self._CaptureSVN = gclient.CaptureSVN | 
| 102     gclient.CaptureSVN = self.mox.CreateMockAnything() | 87     gclient.CaptureSVN = self.mox.CreateMockAnything() | 
| 103     self._CaptureSVNInfo = gclient.CaptureSVNInfo | 88     self._CaptureSVNInfo = gclient.CaptureSVNInfo | 
| 104     gclient.CaptureSVNInfo = self.mox.CreateMockAnything() | 89     gclient.CaptureSVNInfo = self.mox.CreateMockAnything() | 
| 105     self._CaptureSVNStatus = gclient.CaptureSVNStatus | 90     self._CaptureSVNStatus = gclient.CaptureSVNStatus | 
| 106     gclient.CaptureSVNStatus = self.mox.CreateMockAnything() | 91     gclient.CaptureSVNStatus = self.mox.CreateMockAnything() | 
| 107     self._FileRead = gclient.FileRead | 92     self._FileRead = gclient.FileRead | 
| 108     gclient.FileRead = self.mox.CreateMockAnything() | 93     gclient.FileRead = self.mox.CreateMockAnything() | 
| 109     self._FileWrite = gclient.FileWrite | 94     self._FileWrite = gclient.FileWrite | 
| 110     gclient.FileWrite = self.mox.CreateMockAnything() | 95     gclient.FileWrite = self.mox.CreateMockAnything() | 
| 111     self._RemoveDirectory = gclient.RemoveDirectory | 96     self._RemoveDirectory = gclient.RemoveDirectory | 
| 112     gclient.RemoveDirectory = self.mox.CreateMockAnything() | 97     gclient.RemoveDirectory = self.mox.CreateMockAnything() | 
| 113     self._RunSVN = gclient.RunSVN | 98     self._RunSVN = gclient.RunSVN | 
| 114     gclient.RunSVN = self.mox.CreateMockAnything() | 99     gclient.RunSVN = self.mox.CreateMockAnything() | 
| 115     self._RunSVNAndGetFileList = gclient.RunSVNAndGetFileList | 100     self._RunSVNAndGetFileList = gclient.RunSVNAndGetFileList | 
| 116     gclient.RunSVNAndGetFileList = self.mox.CreateMockAnything() | 101     gclient.RunSVNAndGetFileList = self.mox.CreateMockAnything() | 
| 117     self._sys_stdout = gclient.sys.stdout | 102     # Doesn't seem to work very well: | 
| 118     gclient.sys.stdout = self.mox.CreateMock(self._sys_stdout) | 103     self._os = gclient.os | 
|  | 104     gclient.os = self.mox.CreateMock(os) | 
|  | 105     self._sys = gclient.sys | 
|  | 106     gclient.sys = self.mox.CreateMock(sys) | 
| 119     self._subprocess = gclient.subprocess | 107     self._subprocess = gclient.subprocess | 
| 120     gclient.subprocess = self.mox.CreateMock(subprocess) | 108     gclient.subprocess = self.mox.CreateMock(subprocess) | 
| 121 | 109 | 
| 122   def tearDown(self): | 110   def tearDown(self): | 
| 123     gclient.CaptureSVN = self._CaptureSVN | 111     gclient.CaptureSVN = self._CaptureSVN | 
| 124     gclient.CaptureSVNInfo = self._CaptureSVNInfo | 112     gclient.CaptureSVNInfo = self._CaptureSVNInfo | 
| 125     gclient.CaptureSVNStatus = self._CaptureSVNStatus | 113     gclient.CaptureSVNStatus = self._CaptureSVNStatus | 
| 126     gclient.FileRead = self._FileRead | 114     gclient.FileRead = self._FileRead | 
| 127     gclient.FileWrite = self._FileWrite | 115     gclient.FileWrite = self._FileWrite | 
| 128     gclient.RemoveDirectory = self._RemoveDirectory | 116     gclient.RemoveDirectory = self._RemoveDirectory | 
| 129     gclient.RunSVN = self._RunSVN | 117     gclient.RunSVN = self._RunSVN | 
| 130     gclient.RunSVNAndGetFileList = self._RunSVNAndGetFileList | 118     gclient.RunSVNAndGetFileList = self._RunSVNAndGetFileList | 
| 131     gclient.sys.stdout = self._sys_stdout | 119     # Doesn't seem to work very well: | 
|  | 120     gclient.os = self._os | 
|  | 121     gclient.sys = self._sys | 
| 132     gclient.subprocess = self._subprocess | 122     gclient.subprocess = self._subprocess | 
| 133 | 123 | 
| 134 | 124 | 
| 135 class GclientTestCase(GClientBaseTestCase): | 125 class GclientTestCase(BaseTestCase): | 
| 136   class OptionsObject(object): | 126   class OptionsObject(object): | 
| 137     def __init__(self, test_case, verbose=False, spec=None, | 127     def __init__(self, test_case, verbose=False, spec=None, | 
| 138                  config_filename='a_file_name', | 128                  config_filename='a_file_name', | 
| 139                  entries_filename='a_entry_file_name', | 129                  entries_filename='a_entry_file_name', | 
| 140                  deps_file='a_deps_file_name', force=False): | 130                  deps_file='a_deps_file_name', force=False): | 
| 141       self.verbose = verbose | 131       self.verbose = verbose | 
| 142       self.spec = spec | 132       self.spec = spec | 
| 143       self.config_filename = config_filename | 133       self.config_filename = config_filename | 
| 144       self.entries_filename = entries_filename | 134       self.entries_filename = entries_filename | 
| 145       self.deps_file = deps_file | 135       self.deps_file = deps_file | 
| 146       self.force = force | 136       self.force = force | 
| 147       self.revisions = [] | 137       self.revisions = [] | 
| 148       self.manually_grab_svn_rev = True | 138       self.manually_grab_svn_rev = True | 
| 149       self.deps_os = None | 139       self.deps_os = None | 
| 150       self.head = False | 140       self.head = False | 
| 151 | 141 | 
| 152       # Mox | 142       # Mox | 
|  | 143       self.stdout = test_case.stdout | 
| 153       self.path_exists = test_case.path_exists | 144       self.path_exists = test_case.path_exists | 
| 154       self.platform = test_case.platform | 145       self.platform = test_case.platform | 
| 155       self.gclient = test_case.gclient | 146       self.gclient = test_case.gclient | 
| 156       self.scm_wrapper = test_case.scm_wrapper | 147       self.scm_wrapper = test_case.scm_wrapper | 
| 157 | 148 | 
| 158   def setUp(self): | 149   def setUp(self): | 
| 159     GClientBaseTestCase.setUp(self) | 150     BaseTestCase.setUp(self) | 
|  | 151     self.stdout = self.mox.CreateMock(sys.stdout) | 
| 160     #self.subprocess = self.mox.CreateMock(subprocess) | 152     #self.subprocess = self.mox.CreateMock(subprocess) | 
| 161     # Stub os.path.exists. | 153     # Stub os.path.exists. | 
| 162     self.path_exists = self.mox.CreateMockAnything() | 154     self.path_exists = self.mox.CreateMockAnything() | 
|  | 155     self.sys = self.mox.CreateMock(sys) | 
| 163     self.platform = 'darwin' | 156     self.platform = 'darwin' | 
| 164 | 157 | 
| 165     self.gclient = self.mox.CreateMock(gclient.GClient) | 158     self.gclient = self.mox.CreateMock(gclient.GClient) | 
| 166     self.scm_wrapper = self.mox.CreateMock(gclient.SCMWrapper) | 159     self.scm_wrapper = self.mox.CreateMock(gclient.SCMWrapper) | 
| 167 | 160 | 
| 168     self.args = Args() | 161     self.args = Args() | 
| 169     self.root_dir = Dir() | 162     self.root_dir = Dir() | 
| 170     self.url = Url() | 163     self.url = Url() | 
| 171 | 164 | 
| 172 | 165 | 
| 173 class GClientCommandsTestCase(GClientBaseTestCase): | 166 class GClientCommandsTestCase(BaseTestCase): | 
| 174   def testCommands(self): | 167   def testCommands(self): | 
| 175     known_commands = [gclient.DoCleanup, gclient.DoConfig, gclient.DoDiff, | 168     known_commands = [gclient.DoCleanup, gclient.DoConfig, gclient.DoDiff, | 
| 176                       gclient.DoHelp, gclient.DoStatus, gclient.DoUpdate, | 169                       gclient.DoHelp, gclient.DoStatus, gclient.DoUpdate, | 
| 177                       gclient.DoRevert, gclient.DoRunHooks, gclient.DoRevInfo] | 170                       gclient.DoRevert, gclient.DoRunHooks, gclient.DoRevInfo] | 
| 178     for (k,v) in gclient.gclient_command_map.iteritems(): | 171     for (k,v) in gclient.gclient_command_map.iteritems(): | 
| 179       # If it fails, you need to add a test case for the new command. | 172       # If it fails, you need to add a test case for the new command. | 
| 180       self.assert_(v in known_commands) | 173       self.assert_(v in known_commands) | 
| 181     self.mox.ReplayAll() | 174     self.mox.ReplayAll() | 
| 182     self.mox.VerifyAll() | 175     self.mox.VerifyAll() | 
| 183 | 176 | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 224     options.gclient.SaveConfig() | 217     options.gclient.SaveConfig() | 
| 225 | 218 | 
| 226     self.mox.ReplayAll() | 219     self.mox.ReplayAll() | 
| 227     gclient.DoConfig(options, | 220     gclient.DoConfig(options, | 
| 228                      ('http://svn/url/the_name', 'other', 'args', 'ignored')) | 221                      ('http://svn/url/the_name', 'other', 'args', 'ignored')) | 
| 229     self.mox.VerifyAll() | 222     self.mox.VerifyAll() | 
| 230 | 223 | 
| 231 | 224 | 
| 232 class TestDoHelp(GclientTestCase): | 225 class TestDoHelp(GclientTestCase): | 
| 233   def testGetUsage(self): | 226   def testGetUsage(self): | 
| 234     print(gclient.COMMAND_USAGE_TEXT['config']) | 227     options = self.Options() | 
|  | 228     print >> options.stdout, gclient.COMMAND_USAGE_TEXT['config'] | 
|  | 229 | 
| 235     self.mox.ReplayAll() | 230     self.mox.ReplayAll() | 
| 236     options = self.Options() |  | 
| 237     gclient.DoHelp(options, ('config',)) | 231     gclient.DoHelp(options, ('config',)) | 
| 238     self.mox.VerifyAll() | 232     self.mox.VerifyAll() | 
| 239 | 233 | 
| 240   def testTooManyArgs(self): | 234   def testTooManyArgs(self): | 
|  | 235     options = self.Options() | 
| 241     self.mox.ReplayAll() | 236     self.mox.ReplayAll() | 
| 242     options = self.Options() |  | 
| 243     self.assertRaisesError("unknown subcommand 'config'; see 'gclient help'", | 237     self.assertRaisesError("unknown subcommand 'config'; see 'gclient help'", | 
| 244                            gclient.DoHelp, options, ('config', | 238                            gclient.DoHelp, options, ('config', | 
| 245                                                      'another argument')) | 239                                                      'another argument')) | 
| 246     self.mox.VerifyAll() | 240     self.mox.VerifyAll() | 
| 247 | 241 | 
| 248   def testUnknownSubcommand(self): | 242   def testUnknownSubcommand(self): | 
|  | 243     options = self.Options() | 
| 249     self.mox.ReplayAll() | 244     self.mox.ReplayAll() | 
| 250     options = self.Options() |  | 
| 251     self.assertRaisesError("unknown subcommand 'xyzzy'; see 'gclient help'", | 245     self.assertRaisesError("unknown subcommand 'xyzzy'; see 'gclient help'", | 
| 252                            gclient.DoHelp, options, ('xyzzy',)) | 246                            gclient.DoHelp, options, ('xyzzy',)) | 
| 253     self.mox.VerifyAll() | 247     self.mox.VerifyAll() | 
| 254 | 248 | 
| 255 | 249 | 
| 256 class GenericCommandTestCase(GclientTestCase): | 250 class GenericCommandTestCase(GclientTestCase): | 
| 257   def ReturnValue(self, command, function, return_value): | 251   def ReturnValue(self, command, function, return_value): | 
| 258     options = self.Options() | 252     options = self.Options() | 
| 259     self.gclient.LoadCurrentConfig(options).AndReturn(self.gclient) | 253     self.gclient.LoadCurrentConfig(options).AndReturn(self.gclient) | 
| 260     self.gclient.RunOnDeps(command, self.args).AndReturn(return_value) | 254     self.gclient.RunOnDeps(command, self.args).AndReturn(return_value) | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 272     self.assertRaisesError( | 266     self.assertRaisesError( | 
| 273         "client not configured; see 'gclient config'", | 267         "client not configured; see 'gclient config'", | 
| 274         function, options, self.args) | 268         function, options, self.args) | 
| 275     self.mox.VerifyAll() | 269     self.mox.VerifyAll() | 
| 276 | 270 | 
| 277   def Verbose(self, command, function): | 271   def Verbose(self, command, function): | 
| 278     options = self.Options(verbose=True) | 272     options = self.Options(verbose=True) | 
| 279     self.gclient.LoadCurrentConfig(options).AndReturn(self.gclient) | 273     self.gclient.LoadCurrentConfig(options).AndReturn(self.gclient) | 
| 280     text = "# Dummy content\nclient = 'my client'" | 274     text = "# Dummy content\nclient = 'my client'" | 
| 281     self.gclient.ConfigContent().AndReturn(text) | 275     self.gclient.ConfigContent().AndReturn(text) | 
| 282     print(text) | 276     print >>self.stdout, text | 
| 283     self.gclient.RunOnDeps(command, self.args).AndReturn(0) | 277     self.gclient.RunOnDeps(command, self.args).AndReturn(0) | 
| 284 | 278 | 
| 285     self.mox.ReplayAll() | 279     self.mox.ReplayAll() | 
| 286     result = function(options, self.args) | 280     result = function(options, self.args) | 
| 287     self.assertEquals(result, 0) | 281     self.assertEquals(result, 0) | 
| 288     self.mox.VerifyAll() | 282     self.mox.VerifyAll() | 
| 289 | 283 | 
| 290 class TestDoCleanup(GenericCommandTestCase): | 284 class TestDoCleanup(GenericCommandTestCase): | 
| 291   def testGoodClient(self): | 285   def testGoodClient(self): | 
| 292     self.ReturnValue('cleanup', gclient.DoCleanup, 0) | 286     self.ReturnValue('cleanup', gclient.DoCleanup, 0) | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 330     result = function(options, self.args) | 324     result = function(options, self.args) | 
| 331     self.assertEquals(result, return_value) | 325     self.assertEquals(result, return_value) | 
| 332     self.mox.VerifyAll() | 326     self.mox.VerifyAll() | 
| 333 | 327 | 
| 334   def Verbose(self, command, function): | 328   def Verbose(self, command, function): | 
| 335     options = self.Options(verbose=True) | 329     options = self.Options(verbose=True) | 
| 336     self.gclient.LoadCurrentConfig(options).AndReturn(self.gclient) | 330     self.gclient.LoadCurrentConfig(options).AndReturn(self.gclient) | 
| 337     self.gclient.GetVar("solutions") | 331     self.gclient.GetVar("solutions") | 
| 338     text = "# Dummy content\nclient = 'my client'" | 332     text = "# Dummy content\nclient = 'my client'" | 
| 339     self.gclient.ConfigContent().AndReturn(text) | 333     self.gclient.ConfigContent().AndReturn(text) | 
| 340     print(text) | 334     print >>self.stdout, text | 
| 341     self.gclient.RunOnDeps(command, self.args).AndReturn(0) | 335     self.gclient.RunOnDeps(command, self.args).AndReturn(0) | 
| 342 | 336 | 
| 343     self.mox.ReplayAll() | 337     self.mox.ReplayAll() | 
| 344     result = function(options, self.args) | 338     result = function(options, self.args) | 
| 345     self.assertEquals(result, 0) | 339     self.assertEquals(result, 0) | 
| 346     self.mox.VerifyAll() | 340     self.mox.VerifyAll() | 
| 347 | 341 | 
| 348   def Options(self, verbose=False, *args, **kwargs): | 342   def Options(self, verbose=False, *args, **kwargs): | 
| 349     return self.OptionsObject(self, verbose=verbose, *args, **kwargs) | 343     return self.OptionsObject(self, verbose=verbose, *args, **kwargs) | 
| 350 | 344 | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 376   def testBasic(self): | 370   def testBasic(self): | 
| 377     self.ReturnValue('revert', gclient.DoRevert, 0) | 371     self.ReturnValue('revert', gclient.DoRevert, 0) | 
| 378   def testError(self): | 372   def testError(self): | 
| 379     self.ReturnValue('revert', gclient.DoRevert, 42) | 373     self.ReturnValue('revert', gclient.DoRevert, 42) | 
| 380   def testBadClient(self): | 374   def testBadClient(self): | 
| 381     self.BadClient(gclient.DoRevert) | 375     self.BadClient(gclient.DoRevert) | 
| 382 | 376 | 
| 383 | 377 | 
| 384 class GClientClassTestCase(GclientTestCase): | 378 class GClientClassTestCase(GclientTestCase): | 
| 385   def testDir(self): | 379   def testDir(self): | 
| 386     members = [ | 380     members = ['ConfigContent', 'FromImpl', '_VarImpl', '_ParseAllDeps', | 
| 387       'ConfigContent', 'FromImpl', 'GetVar', 'LoadCurrentConfig', | 381       '_ParseSolutionDeps', 'GetVar', '_LoadConfig', 'LoadCurrentConfig', | 
| 388       'RunOnDeps', 'SaveConfig', 'SetConfig', 'SetDefaultConfig', | 382       '_ReadEntries', '_RunHookAction', '_RunHooks', 'RunOnDeps', 'SaveConfig', | 
| 389       'supported_commands', 'PrintRevInfo', | 383       '_SaveEntries', 'SetConfig', 'SetDefaultConfig', 'supported_commands', | 
| 390     ] | 384       'PrintRevInfo'] | 
| 391 | 385 | 
| 392     # If you add a member, be sure to add the relevant test! | 386     # If you add a member, be sure to add the relevant test! | 
| 393     self.compareMembers(gclient.GClient('root_dir', 'options'), members) | 387     actual_members = [x for x in sorted(dir(gclient.GClient)) | 
|  | 388                       if not x.startswith('__')] | 
|  | 389     self.assertEqual(actual_members, sorted(members)) | 
|  | 390     self.mox.ReplayAll() | 
|  | 391     self.mox.VerifyAll() | 
| 394 | 392 | 
| 395   def testSetConfig_ConfigContent_GetVar_SaveConfig_SetDefaultConfig(self): | 393   def testSetConfig_ConfigContent_GetVar_SaveConfig_SetDefaultConfig(self): | 
| 396     options = self.Options() | 394     options = self.Options() | 
| 397     text = "# Dummy content\nclient = 'my client'" | 395     text = "# Dummy content\nclient = 'my client'" | 
| 398     gclient.FileWrite(os.path.join(self.root_dir, options.config_filename), | 396     gclient.FileWrite(os.path.join(self.root_dir, options.config_filename), | 
| 399                       text) | 397                       text) | 
| 400 | 398 | 
| 401     self.mox.ReplayAll() | 399     self.mox.ReplayAll() | 
| 402     client = gclient.GClient(self.root_dir, options) | 400     client = gclient.GClient(self.root_dir, options) | 
| 403     client.SetConfig(text) | 401     client.SetConfig(text) | 
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 726 | 724 | 
| 727     self.mox.ReplayAll() | 725     self.mox.ReplayAll() | 
| 728     client = gclient.GClient(self.root_dir, options) | 726     client = gclient.GClient(self.root_dir, options) | 
| 729     client.SetConfig(gclient_config) | 727     client.SetConfig(gclient_config) | 
| 730     client.RunOnDeps('update', self.args) | 728     client.RunOnDeps('update', self.args) | 
| 731     self.mox.VerifyAll() | 729     self.mox.VerifyAll() | 
| 732 | 730 | 
| 733   def testRunOnDepsRevisions(self): | 731   def testRunOnDepsRevisions(self): | 
| 734     def OptIsRev(options, rev): | 732     def OptIsRev(options, rev): | 
| 735       if not options.revision == str(rev): | 733       if not options.revision == str(rev): | 
| 736         print("options.revision = %s" % options.revision) | 734         print "options.revision = %s" % options.revision | 
| 737       return options.revision == str(rev) | 735       return options.revision == str(rev) | 
| 738     def OptIsRevNone(options): | 736     def OptIsRevNone(options): | 
| 739       if options.revision: | 737       if options.revision: | 
| 740         print("options.revision = %s" % options.revision) | 738         print "options.revision = %s" % options.revision | 
| 741       return options.revision == None | 739       return options.revision == None | 
| 742     def OptIsRev42(options): | 740     def OptIsRev42(options): | 
| 743       return OptIsRev(options, 42) | 741       return OptIsRev(options, 42) | 
| 744     def OptIsRev123(options): | 742     def OptIsRev123(options): | 
| 745       return OptIsRev(options, 123) | 743       return OptIsRev(options, 123) | 
| 746     def OptIsRev333(options): | 744     def OptIsRev333(options): | 
| 747       return OptIsRev(options, 333) | 745       return OptIsRev(options, 333) | 
| 748 | 746 | 
| 749     # Fake .gclient file. | 747     # Fake .gclient file. | 
| 750     gclient_config = """solutions = [ { | 748     gclient_config = """solutions = [ { | 
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1053   def test_LoadConfig(self): | 1051   def test_LoadConfig(self): | 
| 1054     pass | 1052     pass | 
| 1055   def test_ReadEntries(self): | 1053   def test_ReadEntries(self): | 
| 1056     pass | 1054     pass | 
| 1057   def test_SaveEntries(self): | 1055   def test_SaveEntries(self): | 
| 1058     pass | 1056     pass | 
| 1059   def test_VarImpl(self): | 1057   def test_VarImpl(self): | 
| 1060     pass | 1058     pass | 
| 1061 | 1059 | 
| 1062 | 1060 | 
| 1063 class SCMWrapperTestCase(GClientBaseTestCase): | 1061 class SCMWrapperTestCase(BaseTestCase): | 
| 1064   class OptionsObject(object): | 1062   class OptionsObject(object): | 
| 1065      def __init__(self, test_case, verbose=False, revision=None): | 1063      def __init__(self, test_case, verbose=False, revision=None): | 
| 1066       self.verbose = verbose | 1064       self.verbose = verbose | 
| 1067       self.revision = revision | 1065       self.revision = revision | 
| 1068       self.manually_grab_svn_rev = True | 1066       self.manually_grab_svn_rev = True | 
| 1069       self.deps_os = None | 1067       self.deps_os = None | 
| 1070       self.force = False | 1068       self.force = False | 
| 1071 | 1069 | 
| 1072       # Mox | 1070       # Mox | 
|  | 1071       self.stdout = test_case.stdout | 
| 1073       self.path_exists = test_case.path_exists | 1072       self.path_exists = test_case.path_exists | 
| 1074 | 1073 | 
| 1075   def setUp(self): | 1074   def setUp(self): | 
| 1076     GClientBaseTestCase.setUp(self) | 1075     BaseTestCase.setUp(self) | 
| 1077     self.root_dir = Dir() | 1076     self.root_dir = Dir() | 
| 1078     self.args = Args() | 1077     self.args = Args() | 
| 1079     self.url = Url() | 1078     self.url = Url() | 
| 1080     self.relpath = 'asf' | 1079     self.relpath = 'asf' | 
|  | 1080     self.stdout = self.mox.CreateMock(sys.stdout) | 
| 1081     # Stub os.path.exists. | 1081     # Stub os.path.exists. | 
| 1082     self.path_exists = self.mox.CreateMockAnything() | 1082     self.path_exists = self.mox.CreateMockAnything() | 
| 1083 | 1083 | 
| 1084   def testDir(self): | 1084   def testDir(self): | 
| 1085     members = [ | 1085     members = ['FullUrlForRelativeUrl', 'RunCommand', | 
| 1086       'FullUrlForRelativeUrl', 'RunCommand', 'cleanup', 'diff', 'relpath', | 1086       'cleanup', 'diff', 'revert', 'status', 'update'] | 
| 1087       'revert', 'scm_name', 'status', 'update', 'url', |  | 
| 1088     ] |  | 
| 1089 | 1087 | 
| 1090     # If you add a member, be sure to add the relevant test! | 1088     # If you add a member, be sure to add the relevant test! | 
| 1091     self.compareMembers(gclient.SCMWrapper(), members) | 1089     actual_members = [x for x in sorted(dir(gclient.SCMWrapper)) | 
|  | 1090                       if not x.startswith('__')] | 
|  | 1091     self.assertEqual(actual_members, sorted(members)) | 
|  | 1092     self.mox.ReplayAll() | 
|  | 1093     self.mox.VerifyAll() | 
| 1092 | 1094 | 
| 1093   def testFullUrlForRelativeUrl(self): | 1095   def testFullUrlForRelativeUrl(self): | 
| 1094     self.url = 'svn://a/b/c/d' | 1096     self.url = 'svn://a/b/c/d' | 
| 1095 | 1097 | 
| 1096     self.mox.ReplayAll() | 1098     self.mox.ReplayAll() | 
| 1097     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 1099     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 
| 1098                              relpath=self.relpath) | 1100                              relpath=self.relpath) | 
| 1099     self.assertEqual(scm.FullUrlForRelativeUrl('/crap'), 'svn://a/b/crap') | 1101     self.assertEqual(scm.FullUrlForRelativeUrl('/crap'), 'svn://a/b/crap') | 
| 1100     self.mox.VerifyAll() | 1102     self.mox.VerifyAll() | 
| 1101 | 1103 | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 1116     # TODO(maruel): if ever used. | 1118     # TODO(maruel): if ever used. | 
| 1117     pass | 1119     pass | 
| 1118 | 1120 | 
| 1119   def testRevertMissing(self): | 1121   def testRevertMissing(self): | 
| 1120     options = self.Options(verbose=True) | 1122     options = self.Options(verbose=True) | 
| 1121     gclient.os.path.isdir = self.mox.CreateMockAnything() | 1123     gclient.os.path.isdir = self.mox.CreateMockAnything() | 
| 1122     base_path = os.path.join(self.root_dir, self.relpath) | 1124     base_path = os.path.join(self.root_dir, self.relpath) | 
| 1123     gclient.os.path.isdir(base_path).AndReturn(False) | 1125     gclient.os.path.isdir(base_path).AndReturn(False) | 
| 1124     # It'll to a checkout instead. | 1126     # It'll to a checkout instead. | 
| 1125     options.path_exists(os.path.join(base_path, '.git')).AndReturn(False) | 1127     options.path_exists(os.path.join(base_path, '.git')).AndReturn(False) | 
| 1126     print("\n_____ %s is missing, synching instead" % self.relpath) | 1128     print >>options.stdout, ("\n_____ %s is missing, synching instead" % | 
|  | 1129                              self.relpath) | 
| 1127     # Checkout. | 1130     # Checkout. | 
| 1128     options.path_exists(base_path).AndReturn(False) | 1131     options.path_exists(base_path).AndReturn(False) | 
| 1129     files_list = self.mox.CreateMockAnything() | 1132     files_list = self.mox.CreateMockAnything() | 
| 1130     gclient.RunSVNAndGetFileList(['checkout', self.url, base_path], | 1133     gclient.RunSVNAndGetFileList(options, ['checkout', self.url, base_path], | 
| 1131                                  self.root_dir, files_list) | 1134                                  self.root_dir, files_list) | 
| 1132 | 1135 | 
| 1133     self.mox.ReplayAll() | 1136     self.mox.ReplayAll() | 
| 1134     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 1137     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 
| 1135                              relpath=self.relpath) | 1138                              relpath=self.relpath) | 
| 1136     scm.revert(options, self.args, files_list) | 1139     scm.revert(options, self.args, files_list) | 
| 1137     self.mox.VerifyAll() | 1140     self.mox.VerifyAll() | 
| 1138     gclient.os.path.isdir = os.path.isdir | 1141     gclient.os.path.isdir = os.path.isdir | 
| 1139 | 1142 | 
| 1140   def testRevertNone(self): | 1143   def testRevertNone(self): | 
| 1141     options = self.Options(verbose=True) | 1144     options = self.Options(verbose=True) | 
| 1142     base_path = os.path.join(self.root_dir, self.relpath) | 1145     base_path = os.path.join(self.root_dir, self.relpath) | 
| 1143     gclient.os.path.isdir = self.mox.CreateMockAnything() | 1146     gclient.os.path.isdir = self.mox.CreateMockAnything() | 
| 1144     gclient.os.path.isdir(base_path).AndReturn(True) | 1147     gclient.os.path.isdir(base_path).AndReturn(True) | 
| 1145     gclient.CaptureSVNStatus(base_path).AndReturn([]) | 1148     gclient.CaptureSVNStatus(options, base_path).AndReturn([]) | 
| 1146 | 1149 | 
| 1147     self.mox.ReplayAll() | 1150     self.mox.ReplayAll() | 
| 1148     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 1151     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 
| 1149                              relpath=self.relpath) | 1152                              relpath=self.relpath) | 
| 1150     file_list = [] | 1153     file_list = [] | 
| 1151     scm.revert(options, self.args, file_list) | 1154     scm.revert(options, self.args, file_list) | 
| 1152     self.mox.VerifyAll() | 1155     self.mox.VerifyAll() | 
| 1153     gclient.os.path.isdir = os.path.isdir | 1156     gclient.os.path.isdir = os.path.isdir | 
| 1154 | 1157 | 
| 1155   def testRevert2Files(self): | 1158   def testRevert2Files(self): | 
| 1156     options = self.Options(verbose=True) | 1159     options = self.Options(verbose=True) | 
| 1157     base_path = os.path.join(self.root_dir, self.relpath) | 1160     base_path = os.path.join(self.root_dir, self.relpath) | 
| 1158     gclient.os.path.isdir = self.mox.CreateMockAnything() | 1161     gclient.os.path.isdir = self.mox.CreateMockAnything() | 
| 1159     gclient.os.path.isdir(base_path).AndReturn(True) | 1162     gclient.os.path.isdir(base_path).AndReturn(True) | 
| 1160     items = [ | 1163     items = [ | 
| 1161       gclient.FileStatus('a', 'M', ' ', ' ', ' '), | 1164       gclient.FileStatus('a', 'M', ' ', ' ', ' '), | 
| 1162       gclient.FileStatus('b', 'A', ' ', ' ', ' '), | 1165       gclient.FileStatus('b', 'A', ' ', ' ', ' '), | 
| 1163     ] | 1166     ] | 
| 1164     gclient.CaptureSVNStatus(base_path).AndReturn(items) | 1167     gclient.CaptureSVNStatus(options, base_path).AndReturn(items) | 
| 1165 | 1168 | 
| 1166     print(os.path.join(base_path, 'a')) | 1169     print >>options.stdout, os.path.join(base_path, 'a') | 
| 1167     print(os.path.join(base_path, 'b')) | 1170     print >>options.stdout, os.path.join(base_path, 'b') | 
| 1168     gclient.RunSVN(['revert', 'a', 'b'], base_path) | 1171     gclient.RunSVN(options, ['revert', 'a', 'b'], base_path) | 
| 1169 | 1172 | 
| 1170     self.mox.ReplayAll() | 1173     self.mox.ReplayAll() | 
| 1171     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 1174     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 
| 1172                              relpath=self.relpath) | 1175                              relpath=self.relpath) | 
| 1173     file_list = [] | 1176     file_list = [] | 
| 1174     scm.revert(options, self.args, file_list) | 1177     scm.revert(options, self.args, file_list) | 
| 1175     self.mox.VerifyAll() | 1178     self.mox.VerifyAll() | 
| 1176     gclient.os.path.isdir = os.path.isdir | 1179     gclient.os.path.isdir = os.path.isdir | 
| 1177 | 1180 | 
| 1178   def testStatus(self): | 1181   def testStatus(self): | 
| 1179     options = self.Options(verbose=True) | 1182     options = self.Options(verbose=True) | 
| 1180     base_path = os.path.join(self.root_dir, self.relpath) | 1183     base_path = os.path.join(self.root_dir, self.relpath) | 
| 1181     gclient.os.path.isdir = self.mox.CreateMockAnything() | 1184     gclient.os.path.isdir = self.mox.CreateMockAnything() | 
| 1182     gclient.os.path.isdir(base_path).AndReturn(True) | 1185     gclient.os.path.isdir(base_path).AndReturn(True) | 
| 1183     gclient.RunSVNAndGetFileList(['status'] + self.args, base_path, | 1186     gclient.RunSVNAndGetFileList(options, ['status'] + self.args, base_path, | 
| 1184                                  []).AndReturn(None) | 1187                                  []).AndReturn(None) | 
| 1185 | 1188 | 
| 1186     self.mox.ReplayAll() | 1189     self.mox.ReplayAll() | 
| 1187     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 1190     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 
| 1188                              relpath=self.relpath) | 1191                              relpath=self.relpath) | 
| 1189     file_list = [] | 1192     file_list = [] | 
| 1190     self.assertEqual(scm.status(options, self.args, file_list), None) | 1193     self.assertEqual(scm.status(options, self.args, file_list), None) | 
| 1191     self.mox.VerifyAll() | 1194     self.mox.VerifyAll() | 
| 1192 | 1195 | 
| 1193 | 1196 | 
| 1194   # TODO(maruel):  TEST REVISIONS!!! | 1197   # TODO(maruel):  TEST REVISIONS!!! | 
| 1195   # TODO(maruel):  TEST RELOCATE!!! | 1198   # TODO(maruel):  TEST RELOCATE!!! | 
| 1196   def testUpdateCheckout(self): | 1199   def testUpdateCheckout(self): | 
| 1197     options = self.Options(verbose=True) | 1200     options = self.Options(verbose=True) | 
| 1198     base_path = os.path.join(self.root_dir, self.relpath) | 1201     base_path = os.path.join(self.root_dir, self.relpath) | 
| 1199     file_info = gclient.PrintableObject() | 1202     file_info = gclient.PrintableObject() | 
| 1200     file_info.root = 'blah' | 1203     file_info.root = 'blah' | 
| 1201     file_info.url = self.url | 1204     file_info.url = self.url | 
| 1202     file_info.uuid = 'ABC' | 1205     file_info.uuid = 'ABC' | 
| 1203     file_info.revision = 42 | 1206     file_info.revision = 42 | 
| 1204     options.path_exists(os.path.join(base_path, '.git')).AndReturn(False) | 1207     options.path_exists(os.path.join(base_path, '.git')).AndReturn(False) | 
| 1205     # Checkout. | 1208     # Checkout. | 
| 1206     options.path_exists(base_path).AndReturn(False) | 1209     options.path_exists(base_path).AndReturn(False) | 
| 1207     files_list = self.mox.CreateMockAnything() | 1210     files_list = self.mox.CreateMockAnything() | 
| 1208     gclient.RunSVNAndGetFileList(['checkout', self.url, base_path], | 1211     gclient.RunSVNAndGetFileList(options, ['checkout', self.url, base_path], | 
| 1209                                  self.root_dir, files_list) | 1212                                  self.root_dir, files_list) | 
| 1210     self.mox.ReplayAll() | 1213     self.mox.ReplayAll() | 
| 1211     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 1214     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 
| 1212                              relpath=self.relpath) | 1215                              relpath=self.relpath) | 
| 1213     scm.update(options, (), files_list) | 1216     scm.update(options, (), files_list) | 
| 1214     self.mox.VerifyAll() | 1217     self.mox.VerifyAll() | 
| 1215 | 1218 | 
| 1216   def testUpdateUpdate(self): | 1219   def testUpdateUpdate(self): | 
| 1217     options = self.Options(verbose=True) | 1220     options = self.Options(verbose=True) | 
| 1218     base_path = os.path.join(self.root_dir, self.relpath) | 1221     base_path = os.path.join(self.root_dir, self.relpath) | 
| 1219     options.force = True | 1222     options.force = True | 
| 1220     file_info = { | 1223     file_info = { | 
| 1221       'Repository Root': 'blah', | 1224       'Repository Root': 'blah', | 
| 1222       'URL': self.url, | 1225       'URL': self.url, | 
| 1223       'UUID': 'ABC', | 1226       'UUID': 'ABC', | 
| 1224       'Revision': 42, | 1227       'Revision': 42, | 
| 1225     } | 1228     } | 
| 1226     options.path_exists(os.path.join(base_path, '.git')).AndReturn(False) | 1229     options.path_exists(os.path.join(base_path, '.git')).AndReturn(False) | 
| 1227     # Checkout or update. | 1230     # Checkout or update. | 
| 1228     options.path_exists(base_path).AndReturn(True) | 1231     options.path_exists(base_path).AndReturn(True) | 
| 1229     gclient.CaptureSVNInfo(os.path.join(base_path, "."), '.' | 1232     gclient.CaptureSVNInfo(options, os.path.join(base_path, "."), '.' | 
| 1230         ).AndReturn(file_info) | 1233         ).AndReturn(file_info) | 
| 1231     # Cheat a bit here. | 1234     # Cheat a bit here. | 
| 1232     gclient.CaptureSVNInfo(file_info['URL'], '.').AndReturn(file_info) | 1235     gclient.CaptureSVNInfo(options, file_info['URL'], '.').AndReturn(file_info) | 
| 1233     additional_args = [] | 1236     additional_args = [] | 
| 1234     if options.manually_grab_svn_rev: | 1237     if options.manually_grab_svn_rev: | 
| 1235       additional_args = ['--revision', str(file_info['Revision'])] | 1238       additional_args = ['--revision', str(file_info['Revision'])] | 
| 1236     files_list = [] | 1239     files_list = [] | 
| 1237     gclient.RunSVNAndGetFileList(['update', base_path] + additional_args, | 1240     gclient.RunSVNAndGetFileList(options, ['update', base_path] + additional_arg
      s, | 
| 1238                                  self.root_dir, files_list) | 1241                                  self.root_dir, files_list) | 
| 1239 | 1242 | 
| 1240     self.mox.ReplayAll() | 1243     self.mox.ReplayAll() | 
| 1241     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 1244     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 
| 1242                              relpath=self.relpath) | 1245                              relpath=self.relpath) | 
| 1243     scm.update(options, (), files_list) | 1246     scm.update(options, (), files_list) | 
| 1244     self.mox.VerifyAll() | 1247     self.mox.VerifyAll() | 
| 1245 | 1248 | 
| 1246   def testUpdateGit(self): | 1249   def testUpdateGit(self): | 
| 1247     options = self.Options(verbose=True) | 1250     options = self.Options(verbose=True) | 
| 1248     options.path_exists(os.path.join(self.root_dir, self.relpath, '.git') | 1251     options.path_exists(os.path.join(self.root_dir, self.relpath, '.git') | 
| 1249         ).AndReturn(True) | 1252         ).AndReturn(True) | 
| 1250     print("________ found .git directory; skipping %s" % self.relpath) | 1253     print >> options.stdout, ( | 
|  | 1254         "________ found .git directory; skipping %s" % self.relpath) | 
| 1251 | 1255 | 
| 1252     self.mox.ReplayAll() | 1256     self.mox.ReplayAll() | 
| 1253     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 1257     scm = gclient.SCMWrapper(url=self.url, root_dir=self.root_dir, | 
| 1254                              relpath=self.relpath) | 1258                              relpath=self.relpath) | 
| 1255     file_list = [] | 1259     file_list = [] | 
| 1256     scm.update(options, self.args, file_list) | 1260     scm.update(options, self.args, file_list) | 
| 1257     self.mox.VerifyAll() | 1261     self.mox.VerifyAll() | 
| 1258 | 1262 | 
| 1259   def testGetSVNFileInfo(self): | 1263   def testGetSVNFileInfo(self): | 
| 1260     xml_text = r"""<?xml version="1.0"?> | 1264     xml_text = r"""<?xml version="1.0"?> | 
| 1261 <info> | 1265 <info> | 
| 1262 <entry kind="file" path="%s" revision="14628"> | 1266 <entry kind="file" path="%s" revision="14628"> | 
| 1263 <url>http://src.chromium.org/svn/trunk/src/chrome/app/d</url> | 1267 <url>http://src.chromium.org/svn/trunk/src/chrome/app/d</url> | 
| 1264 <repository><root>http://src.chromium.org/svn</root></repository> | 1268 <repository><root>http://src.chromium.org/svn</root></repository> | 
| 1265 <wc-info> | 1269 <wc-info> | 
| 1266 <schedule>add</schedule> | 1270 <schedule>add</schedule> | 
| 1267 <depth>infinity</depth> | 1271 <depth>infinity</depth> | 
| 1268 <copy-from-url>http://src.chromium.org/svn/trunk/src/chrome/app/DEPS</copy-from-
      url> | 1272 <copy-from-url>http://src.chromium.org/svn/trunk/src/chrome/app/DEPS</copy-from-
      url> | 
| 1269 <copy-from-rev>14628</copy-from-rev> | 1273 <copy-from-rev>14628</copy-from-rev> | 
| 1270 <checksum>369f59057ba0e6d9017e28f8bdfb1f43</checksum> | 1274 <checksum>369f59057ba0e6d9017e28f8bdfb1f43</checksum> | 
| 1271 </wc-info> | 1275 </wc-info> | 
| 1272 </entry> | 1276 </entry> | 
| 1273 </info> | 1277 </info> | 
| 1274 """ % self.url | 1278 """ % self.url | 
| 1275     gclient.CaptureSVN(['info', '--xml', self.url], '.').AndReturn(xml_text) | 1279     options = self.Options(verbose=True) | 
|  | 1280     gclient.CaptureSVN(options, ['info', '--xml', self.url], | 
|  | 1281                        '.').AndReturn(xml_text) | 
| 1276     expected = { | 1282     expected = { | 
| 1277       'URL': 'http://src.chromium.org/svn/trunk/src/chrome/app/d', | 1283       'URL': 'http://src.chromium.org/svn/trunk/src/chrome/app/d', | 
| 1278       'UUID': None, | 1284       'UUID': None, | 
| 1279       'Repository Root': 'http://src.chromium.org/svn', | 1285       'Repository Root': 'http://src.chromium.org/svn', | 
| 1280       'Schedule': 'add', | 1286       'Schedule': 'add', | 
| 1281       'Copied From URL': 'http://src.chromium.org/svn/trunk/src/chrome/app/DEPS'
      , | 1287       'Copied From URL': 'http://src.chromium.org/svn/trunk/src/chrome/app/DEPS'
      , | 
| 1282       'Copied From Rev': '14628', | 1288       'Copied From Rev': '14628', | 
| 1283       'Path': self.url, | 1289       'Path': self.url, | 
| 1284       'Revision': 14628, | 1290       'Revision': 14628, | 
| 1285       'Node Kind': 'file', | 1291       'Node Kind': 'file', | 
| 1286     } | 1292     } | 
| 1287     self.mox.ReplayAll() | 1293     self.mox.ReplayAll() | 
| 1288     file_info = self._CaptureSVNInfo(self.url, '.') | 1294     file_info = self._CaptureSVNInfo(options, self.url, '.') | 
| 1289     self.assertEquals(sorted(file_info.items()), sorted(expected.items())) | 1295     self.assertEquals(sorted(file_info.items()), sorted(expected.items())) | 
| 1290     self.mox.VerifyAll() | 1296     self.mox.VerifyAll() | 
| 1291 | 1297 | 
| 1292   def testCaptureSvnInfo(self): | 1298   def testCaptureSvnInfo(self): | 
| 1293     xml_text = """<?xml version="1.0"?> | 1299     xml_text = """<?xml version="1.0"?> | 
| 1294 <info> | 1300 <info> | 
| 1295 <entry | 1301 <entry | 
| 1296    kind="dir" | 1302    kind="dir" | 
| 1297    path="." | 1303    path="." | 
| 1298    revision="35"> | 1304    revision="35"> | 
| 1299 <url>%s</url> | 1305 <url>%s</url> | 
| 1300 <repository> | 1306 <repository> | 
| 1301 <root>%s</root> | 1307 <root>%s</root> | 
| 1302 <uuid>7b9385f5-0452-0410-af26-ad4892b7a1fb</uuid> | 1308 <uuid>7b9385f5-0452-0410-af26-ad4892b7a1fb</uuid> | 
| 1303 </repository> | 1309 </repository> | 
| 1304 <wc-info> | 1310 <wc-info> | 
| 1305 <schedule>normal</schedule> | 1311 <schedule>normal</schedule> | 
| 1306 <depth>infinity</depth> | 1312 <depth>infinity</depth> | 
| 1307 </wc-info> | 1313 </wc-info> | 
| 1308 <commit | 1314 <commit | 
| 1309    revision="35"> | 1315    revision="35"> | 
| 1310 <author>maruel</author> | 1316 <author>maruel</author> | 
| 1311 <date>2008-12-04T20:12:19.685120Z</date> | 1317 <date>2008-12-04T20:12:19.685120Z</date> | 
| 1312 </commit> | 1318 </commit> | 
| 1313 </entry> | 1319 </entry> | 
| 1314 </info> | 1320 </info> | 
| 1315 """ % (self.url, self.root_dir) | 1321 """ % (self.url, self.root_dir) | 
| 1316     gclient.CaptureSVN(['info', '--xml', self.url], '.').AndReturn(xml_text) | 1322     options = self.Options(verbose=True) | 
|  | 1323     gclient.CaptureSVN(options, ['info', '--xml', self.url], | 
|  | 1324                        '.').AndReturn(xml_text) | 
| 1317     self.mox.ReplayAll() | 1325     self.mox.ReplayAll() | 
| 1318     file_info = self._CaptureSVNInfo(self.url, '.') | 1326     file_info = self._CaptureSVNInfo(options, self.url, '.') | 
| 1319     expected = { | 1327     expected = { | 
| 1320       'URL': self.url, | 1328       'URL': self.url, | 
| 1321       'UUID': '7b9385f5-0452-0410-af26-ad4892b7a1fb', | 1329       'UUID': '7b9385f5-0452-0410-af26-ad4892b7a1fb', | 
| 1322       'Revision': 35, | 1330       'Revision': 35, | 
| 1323       'Repository Root': self.root_dir, | 1331       'Repository Root': self.root_dir, | 
| 1324       'Schedule': 'normal', | 1332       'Schedule': 'normal', | 
| 1325       'Copied From URL': None, | 1333       'Copied From URL': None, | 
| 1326       'Copied From Rev': None, | 1334       'Copied From Rev': None, | 
| 1327       'Path': '.', | 1335       'Path': '.', | 
| 1328       'Node Kind': 'dir', | 1336       'Node Kind': 'dir', | 
| 1329     } | 1337     } | 
| 1330     self.assertEqual(file_info, expected) | 1338     self.assertEqual(file_info, expected) | 
| 1331     self.mox.VerifyAll() | 1339     self.mox.VerifyAll() | 
| 1332 | 1340 | 
| 1333 | 1341 | 
| 1334 class RunSVNTestCase(BaseTestCase): |  | 
| 1335   def setUp(self): |  | 
| 1336     self.mox = mox.Mox() |  | 
| 1337     self._OldSubprocessCall = gclient.SubprocessCall |  | 
| 1338     gclient.SubprocessCall = self.mox.CreateMockAnything() |  | 
| 1339 |  | 
| 1340   def tearDown(self): |  | 
| 1341     gclient.SubprocessCall = self._OldSubprocessCall |  | 
| 1342 |  | 
| 1343   def testRunSVN(self): |  | 
| 1344     param2 = 'bleh' |  | 
| 1345     gclient.SubprocessCall(['svn', 'foo', 'bar'], param2).AndReturn(None) |  | 
| 1346     self.mox.ReplayAll() |  | 
| 1347     gclient.RunSVN(['foo', 'bar'], param2) |  | 
| 1348     self.mox.VerifyAll() |  | 
| 1349 |  | 
| 1350 |  | 
| 1351 if __name__ == '__main__': | 1342 if __name__ == '__main__': | 
| 1352   unittest.main() | 1343   unittest.main() | 
| 1353 | 1344 | 
| 1354 # vim: ts=2:sw=2:tw=80:et: | 1345 # vim: ts=2:sw=2:tw=80:et: | 
| OLD | NEW | 
|---|