diff options
author | Jack Neus <jackneus@google.com> | 2021-07-20 20:52:33 +0000 |
---|---|---|
committer | Jack Neus <jackneus@google.com> | 2021-07-23 18:03:11 +0000 |
commit | 6ea0caea86f4c6b1f934b682a3aa7722e98a46f9 (patch) | |
tree | f54707aa6778f60078aef727210669f22f87de4e /tests/test_manifest_xml.py | |
parent | 8e983bbc0f5f48aa38d0e1c5a37766ce121d28eb (diff) | |
download | git-repo-6ea0caea86f4c6b1f934b682a3aa7722e98a46f9.tar.gz |
repo: properly handle remote annotations in manifest_xml
BUG=b:192664812
TEST=tests/
Change-Id: I1aa50260f4a00d3cebbd531141e1626825e70127
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/312643
Tested-by: Jack Neus <jackneus@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'tests/test_manifest_xml.py')
-rw-r--r-- | tests/test_manifest_xml.py | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py index 96ee4c4a..59f2a779 100644 --- a/tests/test_manifest_xml.py +++ b/tests/test_manifest_xml.py | |||
@@ -286,6 +286,25 @@ class XmlManifestTests(ManifestParseTestCase): | |||
286 | '<superproject name="superproject"/>' | 286 | '<superproject name="superproject"/>' |
287 | '</manifest>') | 287 | '</manifest>') |
288 | 288 | ||
289 | def test_remote_annotations(self): | ||
290 | """Check remote settings.""" | ||
291 | manifest = self.getXmlManifest(""" | ||
292 | <manifest> | ||
293 | <remote name="test-remote" fetch="http://localhost"> | ||
294 | <annotation name="foo" value="bar"/> | ||
295 | </remote> | ||
296 | </manifest> | ||
297 | """) | ||
298 | self.assertEqual(manifest.remotes['test-remote'].annotations[0].name, 'foo') | ||
299 | self.assertEqual(manifest.remotes['test-remote'].annotations[0].value, 'bar') | ||
300 | self.assertEqual( | ||
301 | sort_attributes(manifest.ToXml().toxml()), | ||
302 | '<?xml version="1.0" ?><manifest>' | ||
303 | '<remote fetch="http://localhost" name="test-remote">' | ||
304 | '<annotation name="foo" value="bar"/>' | ||
305 | '</remote>' | ||
306 | '</manifest>') | ||
307 | |||
289 | 308 | ||
290 | class IncludeElementTests(ManifestParseTestCase): | 309 | class IncludeElementTests(ManifestParseTestCase): |
291 | """Tests for <include>.""" | 310 | """Tests for <include>.""" |
@@ -632,9 +651,17 @@ class RemoteElementTests(ManifestParseTestCase): | |||
632 | def test_remote(self): | 651 | def test_remote(self): |
633 | """Check remote settings.""" | 652 | """Check remote settings.""" |
634 | a = manifest_xml._XmlRemote(name='foo') | 653 | a = manifest_xml._XmlRemote(name='foo') |
635 | b = manifest_xml._XmlRemote(name='bar') | 654 | a.AddAnnotation('key1', 'value1', 'true') |
655 | b = manifest_xml._XmlRemote(name='foo') | ||
656 | b.AddAnnotation('key2', 'value1', 'true') | ||
657 | c = manifest_xml._XmlRemote(name='foo') | ||
658 | c.AddAnnotation('key1', 'value2', 'true') | ||
659 | d = manifest_xml._XmlRemote(name='foo') | ||
660 | d.AddAnnotation('key1', 'value1', 'false') | ||
636 | self.assertEqual(a, a) | 661 | self.assertEqual(a, a) |
637 | self.assertNotEqual(a, b) | 662 | self.assertNotEqual(a, b) |
663 | self.assertNotEqual(a, c) | ||
664 | self.assertNotEqual(a, d) | ||
638 | self.assertNotEqual(a, manifest_xml._Default()) | 665 | self.assertNotEqual(a, manifest_xml._Default()) |
639 | self.assertNotEqual(a, 123) | 666 | self.assertNotEqual(a, 123) |
640 | self.assertNotEqual(a, None) | 667 | self.assertNotEqual(a, None) |