| 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 collections | 5 import collections |
| 6 | 6 |
| 7 from testing_utils import testing | 7 from testing_utils import testing |
| 8 | 8 |
| 9 from common import chromium_deps | 9 from common import chromium_deps |
| 10 from common import deps_parser | 10 from common import deps_parser |
| 11 from common import git_repository | 11 from common import git_repository |
| 12 from common import repository | 12 from common import repository |
| 13 from common.dependency import Dependency | 13 from common.dependency import Dependency, DependencyRoll |
| 14 | 14 |
| 15 | 15 |
| 16 class DummyGitRepository(repository.Repository): | 16 class DummyGitRepository(repository.Repository): |
| 17 RESPONSES = {} | 17 RESPONSES = {} |
| 18 | 18 |
| 19 def __init__(self, *_): | 19 def __init__(self, *_): |
| 20 pass | 20 pass |
| 21 | 21 |
| 22 def GetSource(self, path, revision): | 22 def GetSource(self, path, revision): |
| 23 return self.RESPONSES.get(path, {}).get(revision, None) | 23 return self.RESPONSES.get(path, {}).get(revision, None) |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 'path': 'src/dep3', | 165 'path': 'src/dep3', |
| 166 'repo_url': 'https://url_dep3', | 166 'repo_url': 'https://url_dep3', |
| 167 'old_revision': '3', | 167 'old_revision': '3', |
| 168 'new_revision': None, | 168 'new_revision': None, |
| 169 }, | 169 }, |
| 170 ] | 170 ] |
| 171 | 171 |
| 172 deps_rolls = chromium_deps.GetChromiumDEPSRolls('rev1', 'rev2', 'unix') | 172 deps_rolls = chromium_deps.GetChromiumDEPSRolls('rev1', 'rev2', 'unix') |
| 173 self.assertEqual(expected_deps_rolls, | 173 self.assertEqual(expected_deps_rolls, |
| 174 [roll.ToDict() for roll in deps_rolls]) | 174 [roll.ToDict() for roll in deps_rolls]) |
| 175 |
| 176 def testGetDEPSRollsDict(self): |
| 177 def _MockGetChromiumDEPSRolls(*_): |
| 178 return [ |
| 179 DependencyRoll('src/dep1', 'https://url_dep1', '7', '9'), |
| 180 DependencyRoll('src/dep2', 'https://url_dep2', '3', None) |
| 181 ] |
| 182 |
| 183 self.mock(chromium_deps, 'GetChromiumDEPSRolls', |
| 184 _MockGetChromiumDEPSRolls) |
| 185 |
| 186 expected_deps_rolls_dict = { |
| 187 'src/dep1': DependencyRoll('src/dep1', 'https://url_dep1', '7', '9'), |
| 188 'src/dep2': DependencyRoll('src/dep2', 'https://url_dep2', '3', None), |
| 189 'src/': DependencyRoll( |
| 190 'src/', |
| 191 'https://chromium.googlesource.com/chromium/src.git', '4', '5'), |
| 192 } |
| 193 |
| 194 self.assertEqual(chromium_deps.GetDEPSRollsDict('4', '5', 'all'), |
| 195 expected_deps_rolls_dict) |
| 196 |
| OLD | NEW |