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 checkout.py.""" | 6 """Unit tests for checkout.py.""" |
7 | 7 |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import shutil | 10 import shutil |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 cwd=co.project_path) | 390 cwd=co.project_path) |
391 self.assertEquals('LF\n', out) | 391 self.assertEquals('LF\n', out) |
392 | 392 |
393 def testProcess(self): | 393 def testProcess(self): |
394 self._test_process(self._get_co) | 394 self._test_process(self._get_co) |
395 | 395 |
396 def testPrepare(self): | 396 def testPrepare(self): |
397 self._test_prepare(self._get_co(None)) | 397 self._test_prepare(self._get_co(None)) |
398 | 398 |
399 def testMove(self): | 399 def testMove(self): |
400 self._check_move(self._get_co(None)) | 400 co = self._get_co(None) |
| 401 self._check_move(co) |
| 402 out = subprocess2.check_output( |
| 403 ['svn', 'status'], cwd=co.project_path) |
| 404 expected = ( |
| 405 'A + chromeos/views/webui_menu_widget.h\n' |
| 406 'D chromeos/views/DOMui_menu_widget.h\n') |
| 407 self.assertEquals(expected, out) |
| 408 # Make sure ancestry is what is expected; |
| 409 env = os.environ.copy() |
| 410 env['LANGUAGE'] = 'en_US.UTF-8' |
| 411 out = subprocess2.check_output( |
| 412 ['svn', 'info', 'chromeos/views/webui_menu_widget.h'], |
| 413 cwd=co.project_path, |
| 414 env=env) |
| 415 values = dict(l.split(': ', 1) for l in out.splitlines() if l) |
| 416 expected = { |
| 417 'Checksum': '65837bb3da662c8fa88a4a50940ea7c6', |
| 418 'Copied From Rev': '2', |
| 419 'Copied From URL': |
| 420 '%strunk/chromeos/views/DOMui_menu_widget.h' % self.svn_base, |
| 421 'Name': 'webui_menu_widget.h', |
| 422 'Node Kind': 'file', |
| 423 'Path': 'chromeos/views/webui_menu_widget.h', |
| 424 'Repository Root': '%s' % self.svn_base.rstrip('/'), |
| 425 'Revision': '2', |
| 426 'Schedule': 'add', |
| 427 'URL': '%strunk/chromeos/views/webui_menu_widget.h' % self.svn_base, |
| 428 } |
| 429 self.assertEquals(expected, values) |
401 | 430 |
402 | 431 |
403 class GitSvnCheckout(SvnBaseTest): | 432 class GitSvnCheckout(SvnBaseTest): |
404 name = 'foo.git' | 433 name = 'foo.git' |
405 | 434 |
406 def _get_co(self, post_processors): | 435 def _get_co(self, post_processors): |
407 self.assertNotEqual(False, post_processors) | 436 self.assertNotEqual(False, post_processors) |
408 return checkout.GitSvnCheckout( | 437 return checkout.GitSvnCheckout( |
409 self.root_dir, self.name[:-4], | 438 self.root_dir, self.name[:-4], |
410 self.usr, self.pwd, | 439 self.usr, self.pwd, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 if '-v' in sys.argv: | 606 if '-v' in sys.argv: |
578 DEBUGGING = True | 607 DEBUGGING = True |
579 logging.basicConfig( | 608 logging.basicConfig( |
580 level=logging.DEBUG, | 609 level=logging.DEBUG, |
581 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') | 610 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') |
582 else: | 611 else: |
583 logging.basicConfig( | 612 logging.basicConfig( |
584 level=logging.ERROR, | 613 level=logging.ERROR, |
585 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') | 614 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') |
586 unittest.main() | 615 unittest.main() |
OLD | NEW |