| 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 json | 5 import json |
| 6 import StringIO | 6 import StringIO |
| 7 from testing_utils import testing | 7 from testing_utils import testing |
| 8 import textwrap | 8 import textwrap |
| 9 import urllib2 | 9 import urllib2 |
| 10 | 10 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 def testGetRevertedRevisionNoRevertedCL(self): | 126 def testGetRevertedRevisionNoRevertedCL(self): |
| 127 message = ( | 127 message = ( |
| 128 'Test for not revert cl\n\n' | 128 'Test for not revert cl\n\n' |
| 129 'TBR=test@chromium.org\nNOPRESUBMIT=true\n' | 129 'TBR=test@chromium.org\nNOPRESUBMIT=true\n' |
| 130 'NOTREECHECKS=true\nNOTRY=true\nBUG=424661\n\n' | 130 'NOTREECHECKS=true\nNOTRY=true\nBUG=424661\n\n' |
| 131 'Review URL: https://codereview.chromium.org/1161773008\n\n' | 131 'Review URL: https://codereview.chromium.org/1161773008\n\n' |
| 132 'Cr-Commit-Position: refs/heads/master@{#332062}\n') | 132 'Cr-Commit-Position: refs/heads/master@{#332062}\n') |
| 133 | 133 |
| 134 reverted_revision = repo_util.GetRevertedRevision(message) | 134 reverted_revision = repo_util.GetRevertedRevision(message) |
| 135 self.assertIsNone(reverted_revision) | 135 self.assertIsNone(reverted_revision) |
| 136 | |
| 137 def testGetRepoToCloneUrlDict(self): | |
| 138 def _MockUrlOpen(*_): | |
| 139 output = StringIO.StringIO() | |
| 140 repo_dict = { | |
| 141 'proj1': { | |
| 142 'clone_url': 'https://chromium.googlesource.com/proj1', | |
| 143 'description': 'blabla1', | |
| 144 'name': 'proj1' | |
| 145 }, | |
| 146 'proj2': { | |
| 147 'clone_url': 'https://chromium.googlesource.com/proj2', | |
| 148 'description': 'blabla2', | |
| 149 'name': 'proj2' | |
| 150 } | |
| 151 } | |
| 152 output.write(')]}\'\n') | |
| 153 output.write(json.dumps(repo_dict)) | |
| 154 output.seek(0) | |
| 155 return output | |
| 156 | |
| 157 self.mock(urllib2, 'urlopen', _MockUrlOpen) | |
| 158 | |
| 159 expected_repo_to_clone_url = { | |
| 160 'proj1': 'https://chromium.googlesource.com/proj1', | |
| 161 'proj2': 'https://chromium.googlesource.com/proj2' | |
| 162 } | |
| 163 | |
| 164 self.assertEqual(repo_util.GetRepoToCloneUrlDict('host_url'), | |
| 165 expected_repo_to_clone_url) | |
| OLD | NEW |