| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import base64 | 5 import base64 |
| 6 from datetime import datetime | 6 from datetime import datetime |
| 7 import json | 7 import json |
| 8 import re | 8 import re |
| 9 | 9 |
| 10 from testing_utils import testing | 10 from testing_utils import testing |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 return None | 592 return None |
| 593 | 593 |
| 594 self.mock(git_repository.GitRepository, 'GetCommitsBetweenRevisions', | 594 self.mock(git_repository.GitRepository, 'GetCommitsBetweenRevisions', |
| 595 self._MockGetCommitsBetweenRevisions) | 595 self._MockGetCommitsBetweenRevisions) |
| 596 self.mock(git_repository.GitRepository, 'GetChangeLog', | 596 self.mock(git_repository.GitRepository, 'GetChangeLog', |
| 597 _MockGetChangeLog) | 597 _MockGetChangeLog) |
| 598 | 598 |
| 599 self.assertRaisesRegexp( | 599 self.assertRaisesRegexp( |
| 600 Exception, 'Failed to pull changelog for revision 2', | 600 Exception, 'Failed to pull changelog for revision 2', |
| 601 self.git_repo.GetChangeLogs, '0', '2') | 601 self.git_repo.GetChangeLogs, '0', '2') |
| 602 |
| 603 def testGetRevisionForChromeVersion(self): |
| 604 |
| 605 def _MockGetChangeLog(*_): |
| 606 changelog = ChangeLog.FromDict(DUMMY_CHANGELOG_JSON) |
| 607 changelog.revision = '123a' |
| 608 return changelog |
| 609 |
| 610 self.mock(git_repository.GitRepository, 'GetChangeLog', _MockGetChangeLog) |
| 611 |
| 612 git_repo = git_repository.GitRepository(self.repo_url, |
| 613 self.http_client_for_git) |
| 614 self.assertEqual(git_repo.GetRevisionForChromeVersion('50.0.1234.0'), |
| 615 '123a') |
| 616 |
| 617 def testGetRevisionForChromeVersionFailToGetChangeLog(self): |
| 618 |
| 619 def _MockGetChangeLog(*_): |
| 620 return None |
| 621 |
| 622 self.mock(git_repository.GitRepository, 'GetChangeLog', _MockGetChangeLog) |
| 623 |
| 624 git_repo = git_repository.GitRepository(self.repo_url, |
| 625 self.http_client_for_git) |
| 626 self.assertIsNone(git_repo.GetRevisionForChromeVersion('50.0.1234.0')) |
| OLD | NEW |