summaryrefslogtreecommitdiffstats
path: root/tests/test_manifest_xml.py
diff options
context:
space:
mode:
authorRaman Tenneti <rtenneti@google.com>2021-01-07 16:50:45 -0800
committerRaman Tenneti <rtenneti@google.com>2021-01-08 19:49:52 +0000
commit1bb4fb222d831ed384d6fdef7402d36c19e91b2e (patch)
treeb915dfcb1352d29ce1fdd9b364d591be3e3ee289 /tests/test_manifest_xml.py
parentb64bec6acc0e2a835f427d8424af89dfcddaf08f (diff)
downloadgit-repo-1bb4fb222d831ed384d6fdef7402d36c19e91b2e.tar.gz
manifest_xml: initial support for <superproject>
At most one superproject may be specified. It will be used to specify the URL of superproject. It would have 3 attributes: remote, name, and default. Only "name" is required while the others have reasonable defaults. <remote name="superproject-url" review="<url>" /> <superproject remote="superproject-url" name="platform/superproject"/> TODO: This CL only implements the parsing logic and further work will be in followup CLs. Tested the code with the following commands. $ ./run_tests tests/test_manifest_xml.py $ ./run_tests -v Bug: https://crbug.com/gerrit/13709 Tested-by: Raman Tenneti <rtenneti@google.com> Change-Id: I5b4bba02c8b59601c754cf6b5e4d07a1e16ce167 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/292982 Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'tests/test_manifest_xml.py')
-rw-r--r--tests/test_manifest_xml.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py
index d53ea568..e4adf3c9 100644
--- a/tests/test_manifest_xml.py
+++ b/tests/test_manifest_xml.py
@@ -221,6 +221,65 @@ class XmlManifestTests(unittest.TestCase):
221 self.assertEqual(manifest.repo_hooks_project.name, 'repohooks') 221 self.assertEqual(manifest.repo_hooks_project.name, 'repohooks')
222 self.assertEqual(manifest.repo_hooks_project.enabled_repo_hooks, ['a', 'b']) 222 self.assertEqual(manifest.repo_hooks_project.enabled_repo_hooks, ['a', 'b'])
223 223
224 def test_superproject(self):
225 """Check superproject settings."""
226 manifest = self.getXmlManifest("""
227<manifest>
228 <remote name="test-remote" fetch="http://localhost" />
229 <default remote="test-remote" revision="refs/heads/main" />
230 <superproject name="superproject"/>
231</manifest>
232""")
233 self.assertEqual(manifest.superproject['name'], 'superproject')
234 self.assertEqual(manifest.superproject['remote'].name, 'test-remote')
235 self.assertEqual(
236 manifest.ToXml().toxml(),
237 '<?xml version="1.0" ?><manifest>' +
238 '<remote name="test-remote" fetch="http://localhost"/>' +
239 '<default remote="test-remote" revision="refs/heads/main"/>' +
240 '<superproject name="superproject"/>' +
241 '</manifest>')
242
243 def test_superproject_with_remote(self):
244 """Check superproject settings."""
245 manifest = self.getXmlManifest("""
246<manifest>
247 <remote name="default-remote" fetch="http://localhost" />
248 <remote name="test-remote" fetch="http://localhost" />
249 <default remote="default-remote" revision="refs/heads/main" />
250 <superproject name="superproject" remote="test-remote"/>
251</manifest>
252""")
253 self.assertEqual(manifest.superproject['name'], 'superproject')
254 self.assertEqual(manifest.superproject['remote'].name, 'test-remote')
255 self.assertEqual(
256 manifest.ToXml().toxml(),
257 '<?xml version="1.0" ?><manifest>' +
258 '<remote name="default-remote" fetch="http://localhost"/>' +
259 '<remote name="test-remote" fetch="http://localhost"/>' +
260 '<default remote="default-remote" revision="refs/heads/main"/>' +
261 '<superproject name="superproject" remote="test-remote"/>' +
262 '</manifest>')
263
264 def test_superproject_with_defalut_remote(self):
265 """Check superproject settings."""
266 manifest = self.getXmlManifest("""
267<manifest>
268 <remote name="default-remote" fetch="http://localhost" />
269 <default remote="default-remote" revision="refs/heads/main" />
270 <superproject name="superproject" remote="default-remote"/>
271</manifest>
272""")
273 self.assertEqual(manifest.superproject['name'], 'superproject')
274 self.assertEqual(manifest.superproject['remote'].name, 'default-remote')
275 self.assertEqual(
276 manifest.ToXml().toxml(),
277 '<?xml version="1.0" ?><manifest>' +
278 '<remote name="default-remote" fetch="http://localhost"/>' +
279 '<default remote="default-remote" revision="refs/heads/main"/>' +
280 '<superproject name="superproject"/>' +
281 '</manifest>')
282
224 def test_project_group(self): 283 def test_project_group(self):
225 """Check project group settings.""" 284 """Check project group settings."""
226 manifest = self.getXmlManifest(""" 285 manifest = self.getXmlManifest("""