summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRaman Tenneti <rtenneti@google.com>2021-05-04 12:32:13 -0700
committerRaman Tenneti <rtenneti@google.com>2021-05-04 22:36:01 +0000
commit1c3f57e8f13d4f6dc818bdf06c3a40f768ef1ce5 (patch)
treef9bb9fdaa2859f53104b435d0f7d3202337ec1d9 /tests
parent05638bf77193d53a8568600345733265e4c6a42c (diff)
downloadgit-repo-1c3f57e8f13d4f6dc818bdf06c3a40f768ef1ce5.tar.gz
manifest_xml: initial support for <contactinfo>
It will be used to let manifest authors self-register contact info. This element can be repeated, and any later entries will clobber earlier ones. This would allow manifest authors who extend manifests to specify their own contact info. It would have 1 required attribute: bugurl. "bugurl" specifies the URL to file a bug against the manifest owner. <contactinfo bugurl="bug-url"/> 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: [google internal] b/186220520. Change-Id: I47e765ba2dab5cdf850191129f4d4cd6b803f451 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305203 Tested-by: Raman Tenneti <rtenneti@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_manifest_xml.py59
1 files changed, 38 insertions, 21 deletions
diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py
index e78d85c3..bfdf366e 100644
--- a/tests/test_manifest_xml.py
+++ b/tests/test_manifest_xml.py
@@ -255,10 +255,10 @@ class XmlManifestTests(ManifestParseTestCase):
255 self.assertEqual(manifest.superproject['remote'].name, 'test-remote') 255 self.assertEqual(manifest.superproject['remote'].name, 'test-remote')
256 self.assertEqual( 256 self.assertEqual(
257 manifest.ToXml().toxml(), 257 manifest.ToXml().toxml(),
258 '<?xml version="1.0" ?><manifest>' + 258 '<?xml version="1.0" ?><manifest>'
259 '<remote name="test-remote" fetch="http://localhost"/>' + 259 '<remote name="test-remote" fetch="http://localhost"/>'
260 '<default remote="test-remote" revision="refs/heads/main"/>' + 260 '<default remote="test-remote" revision="refs/heads/main"/>'
261 '<superproject name="superproject"/>' + 261 '<superproject name="superproject"/>'
262 '</manifest>') 262 '</manifest>')
263 263
264 264
@@ -409,10 +409,10 @@ class ProjectElementTests(ManifestParseTestCase):
409 project.SetRevisionId('ABCDEF') 409 project.SetRevisionId('ABCDEF')
410 self.assertEqual( 410 self.assertEqual(
411 manifest.ToXml().toxml(), 411 manifest.ToXml().toxml(),
412 '<?xml version="1.0" ?><manifest>' + 412 '<?xml version="1.0" ?><manifest>'
413 '<remote name="default-remote" fetch="http://localhost"/>' + 413 '<remote name="default-remote" fetch="http://localhost"/>'
414 '<default remote="default-remote" revision="refs/heads/main"/>' + 414 '<default remote="default-remote" revision="refs/heads/main"/>'
415 '<project name="test-name" revision="ABCDEF"/>' + 415 '<project name="test-name" revision="ABCDEF"/>'
416 '</manifest>') 416 '</manifest>')
417 417
418 def test_trailing_slash(self): 418 def test_trailing_slash(self):
@@ -517,10 +517,10 @@ class SuperProjectElementTests(ManifestParseTestCase):
517 self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/superproject') 517 self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/superproject')
518 self.assertEqual( 518 self.assertEqual(
519 manifest.ToXml().toxml(), 519 manifest.ToXml().toxml(),
520 '<?xml version="1.0" ?><manifest>' + 520 '<?xml version="1.0" ?><manifest>'
521 '<remote name="test-remote" fetch="http://localhost"/>' + 521 '<remote name="test-remote" fetch="http://localhost"/>'
522 '<default remote="test-remote" revision="refs/heads/main"/>' + 522 '<default remote="test-remote" revision="refs/heads/main"/>'
523 '<superproject name="superproject"/>' + 523 '<superproject name="superproject"/>'
524 '</manifest>') 524 '</manifest>')
525 525
526 def test_remote(self): 526 def test_remote(self):
@@ -538,11 +538,11 @@ class SuperProjectElementTests(ManifestParseTestCase):
538 self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/platform/superproject') 538 self.assertEqual(manifest.superproject['remote'].url, 'http://localhost/platform/superproject')
539 self.assertEqual( 539 self.assertEqual(
540 manifest.ToXml().toxml(), 540 manifest.ToXml().toxml(),
541 '<?xml version="1.0" ?><manifest>' + 541 '<?xml version="1.0" ?><manifest>'
542 '<remote name="default-remote" fetch="http://localhost"/>' + 542 '<remote name="default-remote" fetch="http://localhost"/>'
543 '<remote name="superproject-remote" fetch="http://localhost"/>' + 543 '<remote name="superproject-remote" fetch="http://localhost"/>'
544 '<default remote="default-remote" revision="refs/heads/main"/>' + 544 '<default remote="default-remote" revision="refs/heads/main"/>'
545 '<superproject name="platform/superproject" remote="superproject-remote"/>' + 545 '<superproject name="platform/superproject" remote="superproject-remote"/>'
546 '</manifest>') 546 '</manifest>')
547 547
548 def test_defalut_remote(self): 548 def test_defalut_remote(self):
@@ -558,8 +558,25 @@ class SuperProjectElementTests(ManifestParseTestCase):
558 self.assertEqual(manifest.superproject['remote'].name, 'default-remote') 558 self.assertEqual(manifest.superproject['remote'].name, 'default-remote')
559 self.assertEqual( 559 self.assertEqual(
560 manifest.ToXml().toxml(), 560 manifest.ToXml().toxml(),
561 '<?xml version="1.0" ?><manifest>' + 561 '<?xml version="1.0" ?><manifest>'
562 '<remote name="default-remote" fetch="http://localhost"/>' + 562 '<remote name="default-remote" fetch="http://localhost"/>'
563 '<default remote="default-remote" revision="refs/heads/main"/>' + 563 '<default remote="default-remote" revision="refs/heads/main"/>'
564 '<superproject name="superproject"/>' + 564 '<superproject name="superproject"/>'
565 '</manifest>') 565 '</manifest>')
566
567
568class ContactinfoElementTests(ManifestParseTestCase):
569 """Tests for <contactinfo>."""
570
571 def test_contactinfo(self):
572 """Check contactinfo settings."""
573 bugurl = 'http://localhost/contactinfo'
574 manifest = self.getXmlManifest(f"""
575<manifest>
576 <contactinfo bugurl="{bugurl}"/>
577</manifest>
578""")
579 self.assertEqual(manifest.contactinfo['bugurl'], bugurl)
580 self.assertEqual(
581 manifest.ToXml().toxml(),
582 f"""<?xml version="1.0" ?><manifest><contactinfo bugurl="{bugurl}"/></manifest>""")