From 37c21c268badc2602a827d2236027e235fff95e0 Mon Sep 17 00:00:00 2001 From: Michael Kelly Date: Sat, 13 Jun 2020 02:10:40 -0700 Subject: Add 'dest-path' to extend-project to support changing path This allows us to move the repository to a new location in the source tree without having to remove-project + add a new project tag. Change-Id: I4dba6151842e57f6f2b8fe60cda260ecea68b7b4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/310962 Reviewed-by: Mike Frysinger Tested-by: Michael Kelly --- tests/test_manifest_xml.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'tests/test_manifest_xml.py') diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py index ce422536..cb3eb855 100644 --- a/tests/test_manifest_xml.py +++ b/tests/test_manifest_xml.py @@ -797,3 +797,49 @@ class RemoveProjectElementTests(ManifestParseTestCase): """) self.assertEqual(manifest.projects, []) + + +class ExtendProjectElementTests(ManifestParseTestCase): + """Tests for .""" + + def test_extend_project_dest_path_single_match(self): + manifest = self.getXmlManifest(""" + + + + + + +""") + self.assertEqual(len(manifest.projects), 1) + self.assertEqual(manifest.projects[0].relpath, 'bar') + + def test_extend_project_dest_path_multi_match(self): + with self.assertRaises(manifest_xml.ManifestParseError): + manifest = self.getXmlManifest(""" + + + + + + + +""") + manifest.projects + + def test_extend_project_dest_path_multi_match_path_specified(self): + manifest = self.getXmlManifest(""" + + + + + + + +""") + self.assertEqual(len(manifest.projects), 2) + if manifest.projects[0].relpath == 'y': + self.assertEqual(manifest.projects[1].relpath, 'bar') + else: + self.assertEqual(manifest.projects[0].relpath, 'bar') + self.assertEqual(manifest.projects[1].relpath, 'y') -- cgit v1.2.3-54-g00ecf