mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-05-07 11:29:27 +00:00
tests: Add extend-project test for additional annotations
Multiple annotations can exist for the same name when extending projects. Add a test case to show this behavior. Change-Id: I12bbd25e642c7e615e32f66a1c364a39ac81902c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/553906 Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Jeffery Miller <jefferymiller@google.com> Tested-by: Jeffery Miller <jefferymiller@google.com>
This commit is contained in:
@@ -1480,6 +1480,46 @@ class ExtendProjectElementTests(ManifestParseTestCase):
|
||||
"</manifest>",
|
||||
)
|
||||
|
||||
def test_extend_project_annotations_multiples(self):
|
||||
manifest = self.getXmlManifest(
|
||||
"""
|
||||
<manifest>
|
||||
<remote name="default-remote" fetch="http://localhost" />
|
||||
<default remote="default-remote" revision="refs/heads/main" />
|
||||
<project name="myproject">
|
||||
<annotation name="foo" value="bar" />
|
||||
<annotation name="few" value="bar" />
|
||||
</project>
|
||||
<extend-project name="myproject">
|
||||
<annotation name="foo" value="new_bar" />
|
||||
<annotation name="new" value="anno" />
|
||||
</extend-project>
|
||||
</manifest>
|
||||
"""
|
||||
)
|
||||
self.assertEqual(
|
||||
[(a.name, a.value) for a in manifest.projects[0].annotations],
|
||||
[
|
||||
("foo", "bar"),
|
||||
("few", "bar"),
|
||||
("foo", "new_bar"),
|
||||
("new", "anno"),
|
||||
],
|
||||
)
|
||||
self.assertEqual(
|
||||
sort_attributes(manifest.ToXml().toxml()),
|
||||
'<?xml version="1.0" ?><manifest>'
|
||||
'<remote fetch="http://localhost" name="default-remote"/>'
|
||||
'<default remote="default-remote" revision="refs/heads/main"/>'
|
||||
'<project name="myproject">'
|
||||
'<annotation name="foo" value="bar"/>'
|
||||
'<annotation name="few" value="bar"/>'
|
||||
'<annotation name="foo" value="new_bar"/>'
|
||||
'<annotation name="new" value="anno"/>'
|
||||
"</project>"
|
||||
"</manifest>",
|
||||
)
|
||||
|
||||
|
||||
class NormalizeUrlTests(ManifestParseTestCase):
|
||||
"""Tests for normalize_url() in manifest_xml.py"""
|
||||
|
||||
Reference in New Issue
Block a user