From 1bb4fb222d831ed384d6fdef7402d36c19e91b2e Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Thu, 7 Jan 2021 16:50:45 -0800 Subject: manifest_xml: initial support for 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. 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 Change-Id: I5b4bba02c8b59601c754cf6b5e4d07a1e16ce167 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/292982 Reviewed-by: Mike Frysinger --- tests/test_manifest_xml.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'tests/test_manifest_xml.py') 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): self.assertEqual(manifest.repo_hooks_project.name, 'repohooks') self.assertEqual(manifest.repo_hooks_project.enabled_repo_hooks, ['a', 'b']) + def test_superproject(self): + """Check superproject settings.""" + manifest = self.getXmlManifest(""" + + + + + +""") + self.assertEqual(manifest.superproject['name'], 'superproject') + self.assertEqual(manifest.superproject['remote'].name, 'test-remote') + self.assertEqual( + manifest.ToXml().toxml(), + '' + + '' + + '' + + '' + + '') + + def test_superproject_with_remote(self): + """Check superproject settings.""" + manifest = self.getXmlManifest(""" + + + + + + +""") + self.assertEqual(manifest.superproject['name'], 'superproject') + self.assertEqual(manifest.superproject['remote'].name, 'test-remote') + self.assertEqual( + manifest.ToXml().toxml(), + '' + + '' + + '' + + '' + + '' + + '') + + def test_superproject_with_defalut_remote(self): + """Check superproject settings.""" + manifest = self.getXmlManifest(""" + + + + + +""") + self.assertEqual(manifest.superproject['name'], 'superproject') + self.assertEqual(manifest.superproject['remote'].name, 'default-remote') + self.assertEqual( + manifest.ToXml().toxml(), + '' + + '' + + '' + + '' + + '') + def test_project_group(self): """Check project group settings.""" manifest = self.getXmlManifest(""" -- cgit v1.2.3-54-g00ecf