repo_sync_manifest: Support custom manifest url.
Originall, repo_sync_manifest always provided the
URL to the internal or external manifest to repo sync.
This is prohibitive for tests that depend on repo_sync_manifest
and that don't want to make network calls. Therefore, allow
callers to directly specify the manifest URL (in tests
this can be a location on disk).
Change-Id: Ib5c8847e4cb7f09c96e2d2a83ba92a47f35c0662
Reviewed-on: https://chromium-review.googlesource.com/1460271
Commit-Ready: Evan Hernandez <evanhernandez@chromium.org>
Tested-by: Evan Hernandez <evanhernandez@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>
diff --git a/scripts/repo_sync_manifest_unittest.py b/scripts/repo_sync_manifest_unittest.py
index ad7630c..4644381 100644
--- a/scripts/repo_sync_manifest_unittest.py
+++ b/scripts/repo_sync_manifest_unittest.py
@@ -35,6 +35,7 @@
self.manifest = os.path.join(self.tempdir, 'manifest.xml')
self.mv_ext = os.path.join(self.tempdir, 'mv_ext')
self.mv_int = os.path.join(self.tempdir, 'mv_int')
+ self.manifest_url = 'manifest.com'
self.repo_mock = self.PatchObject(
repository, 'RepoRepository', autospec=True)
@@ -94,6 +95,26 @@
mock.call().Sync(detach=True, local_manifest=None)
])
+ def testMinimalManifestUrl(self):
+ repo_sync_manifest.main([
+ '--repo-root', self.repo_dir,
+ '--manifest-url', self.manifest_url,
+ ])
+
+ # Ensure manifest_versions is not updated.
+ self.assertEqual(self.refresh_manifest_mock.mock_calls, [])
+
+ # Ensure RepoRepository created and Sync'd as expected.
+ self.assertEqual(self.repo_mock.mock_calls, [
+ mock.call(
+ directory=self.repo_dir,
+ manifest_repo_url=self.manifest_url,
+ branch='master',
+ git_cache_dir=None,
+ ),
+ mock.call().Sync(detach=True, local_manifest=None)
+ ])
+
def testBranch(self):
repo_sync_manifest.main([
'--repo-root', self.repo_dir,