Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: appengine/findit/common/test/chromium_deps_test.py

Issue 2344443005: [Findit] Factoring the gitiles (etc) stuff out into its own directory (Closed)
Patch Set: rebase-update Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 import collections 6 import collections
7 7
8 from testing_utils import testing 8 from testing_utils import testing
9 9
10 from gitiles import git_repository
10 from common import chromium_deps 11 from common import chromium_deps
11 from common import deps_parser 12 from common import deps_parser
12 from common import git_repository
13 from common import repository
14 from common import retry_http_client 13 from common import retry_http_client
15 from common import http_client_appengine 14 from common import http_client_appengine
16 from common.dependency import Dependency, DependencyRoll 15 from common.dependency import Dependency, DependencyRoll
17 16
18 17
19 class DummyGitRepository(repository.Repository): 18 class DummyGitRepository(object):
19 """A class for mocking GitRepository.
20
21 N.B., in order to use this class for mocking, every module we want to
22 test with a mock GitRepository must not import that class directly.
23 Instead they must import the git_repository module and rely on dynamic
24 dispatch to resolve the GitRepository attribute. Otherwise those
25 modules will hold direct links to the real GitRepository class, and
26 so won't dispatch into this mock class for our unit tests."""
27
20 RESPONSES = {} 28 RESPONSES = {}
21 29
22 def __init__(self, *_): 30 def __init__(self, *_):
23 pass 31 pass
24 32
25 def GetSource(self, path, revision): 33 def GetSource(self, path, revision):
26 return self.RESPONSES.get(path, {}).get(revision, None) 34 return self.RESPONSES.get(path, {}).get(revision, None)
27 35
28 36
29 class ChromiumDEPSTest(testing.AppengineTestCase): 37 class ChromiumDEPSTest(testing.AppengineTestCase):
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 'src/', 286 'src/',
279 'https://chromium.googlesource.com/chromium/src.git', '4', '5'), 287 'https://chromium.googlesource.com/chromium/src.git', '4', '5'),
280 } 288 }
281 self.assertEqual(chromium_deps.GetDEPSRollsDict('4', '5', 'all'), 289 self.assertEqual(chromium_deps.GetDEPSRollsDict('4', '5', 'all'),
282 expected_deps_rolls_dict) 290 expected_deps_rolls_dict)
283 291
284 def testIsChromeVersion(self): 292 def testIsChromeVersion(self):
285 self.assertTrue(chromium_deps.IsChromeVersion('50.0.1234.1')) 293 self.assertTrue(chromium_deps.IsChromeVersion('50.0.1234.1'))
286 self.assertFalse(chromium_deps.IsChromeVersion('a.b.c.e')) 294 self.assertFalse(chromium_deps.IsChromeVersion('a.b.c.e'))
287 self.assertFalse(chromium_deps.IsChromeVersion('502.021.2.0.123')) 295 self.assertFalse(chromium_deps.IsChromeVersion('502.021.2.0.123'))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698