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

Unified Diff: appengine/findit/util_scripts/git_checkout/test/local_git_repository_test.py

Issue 2605943002: Removing the mutation in the factories for getting dep repositories (Closed)
Patch Set: rebase Created 3 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: appengine/findit/util_scripts/git_checkout/test/local_git_repository_test.py
diff --git a/appengine/findit/util_scripts/git_checkout/test/local_git_repository_test.py b/appengine/findit/util_scripts/git_checkout/test/local_git_repository_test.py
index 47ad698bd7d60ee358a77b79e8c64e45b5cfaad1..d247397950221029d47c6184f243afc6b0592913 100644
--- a/appengine/findit/util_scripts/git_checkout/test/local_git_repository_test.py
+++ b/appengine/findit/util_scripts/git_checkout/test/local_git_repository_test.py
@@ -38,28 +38,16 @@ class LocalGitRepositoryTest(testing.AppengineTestCase):
self.assertTrue(self.local_repo.repo_url in
local_git_repository.LocalGitRepository._updated_repos)
- def testRepoUrlSetter(self):
- def _MockCloneOrUpdateRepoIfNeeded(*_):
- if not hasattr(_MockCloneOrUpdateRepoIfNeeded, 'clone_or_update_count'):
- _MockCloneOrUpdateRepoIfNeeded.clone_or_update_count = 0
- _MockCloneOrUpdateRepoIfNeeded.clone_or_update_count += 1
-
- repo = local_git_repository.LocalGitRepository()
- self.mock(repo, '_CloneOrUpdateRepoIfNeeded',
- _MockCloneOrUpdateRepoIfNeeded)
-
- repo.repo_url = 'https://repo/path'
- self.assertEqual(_MockCloneOrUpdateRepoIfNeeded.clone_or_update_count, 1)
-
- repo.repo_url = 'https://repo/path'
- self.assertEqual(_MockCloneOrUpdateRepoIfNeeded.clone_or_update_count, 1)
-
- repo.repo_url = 'https://repo/path2'
- self.assertEqual(_MockCloneOrUpdateRepoIfNeeded.clone_or_update_count, 2)
-
- repo.repo_url = None
+ def testInit(self):
+ repo = local_git_repository.LocalGitRepository(None)
self.assertIsNone(repo.repo_url)
+ repo_url = 'https://repo/path'
+ self.mock(local_git_repository.LocalGitRepository,
+ '_CloneOrUpdateRepoIfNeeded', lambda *_: None)
+ repo = local_git_repository.LocalGitRepository(repo_url)
+ self.assertEqual(repo.repo_url, repo_url)
+
def testGetChangeLog(self):
output = textwrap.dedent(
"""
@@ -91,8 +79,8 @@ class LocalGitRepositoryTest(testing.AppengineTestCase):
'https://repo/path/+/revision', None, None)
self.mock(script_util, 'GetCommandOutput', lambda *_: output)
# TODO: compare the objects directly, rather than via ToDict
- self.assertEqual(self.local_repo.GetChangeLog('revision').ToDict(),
- expected_changelog.ToDict())
+ self.assertDictEqual(self.local_repo.GetChangeLog('revision').ToDict(),
+ expected_changelog.ToDict())
def testGetChangeLogNoneCommandOutput(self):
self.mock(script_util, 'GetCommandOutput', lambda *_: None)

Powered by Google App Engine
This is Rietveld 408576698