summaryrefslogtreecommitdiffstats
path: root/tests/test_manifest_xml.py
diff options
context:
space:
mode:
authorMichael Kelly <mkelly@arista.com>2023-09-19 09:51:03 -0700
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-11-08 05:03:20 +0000
commit3652b497bbbd6227b2cb84bb61a0fe8d21ba20d6 (patch)
tree437ade2bdcf975c2f82d5656b3d4c6425f7234d1 /tests/test_manifest_xml.py
parent89f761cfefc406aabc5658e6c0a5cd25812d0525 (diff)
downloadgit-repo-3652b497bbbd6227b2cb84bb61a0fe8d21ba20d6.tar.gz
Correctly handle schema-less URIs for remote fetch URL
Currently we don't deal with schema-less URIs like `git@github.com:foo` at all resulting in a scenario where we append them to the manifest repo URL. In order to deal with this, we munge both the manifest URL and the fetch URL into a format we like and proceed with that. Bug: https://g-issues.gerritcodereview.com/issues/40010331 Change-Id: I7b79fc4ed276630fdbeb235b94e327b172f0879b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/386954 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Michael Kelly <mkelly@arista.com> Commit-Queue: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'tests/test_manifest_xml.py')
-rw-r--r--tests/test_manifest_xml.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py
index 3fcf09fa..11c0c15e 100644
--- a/tests/test_manifest_xml.py
+++ b/tests/test_manifest_xml.py
@@ -1128,3 +1128,32 @@ class ExtendProjectElementTests(ManifestParseTestCase):
1128 ) 1128 )
1129 self.assertEqual(len(manifest.projects), 1) 1129 self.assertEqual(len(manifest.projects), 1)
1130 self.assertEqual(manifest.projects[0].upstream, "bar") 1130 self.assertEqual(manifest.projects[0].upstream, "bar")
1131
1132
1133class NormalizeUrlTests(ManifestParseTestCase):
1134 """Tests for normalize_url() in manifest_xml.py"""
1135
1136 def test_has_trailing_slash(self):
1137 url = "http://foo.com/bar/baz/"
1138 self.assertEqual(
1139 "http://foo.com/bar/baz", manifest_xml.normalize_url(url)
1140 )
1141
1142 def test_has_no_scheme(self):
1143 """Deal with cases where we have no scheme, but we also
1144 aren't dealing with the git SCP-like syntax
1145 """
1146 url = "foo.com/baf/bat"
1147 self.assertEqual(url, manifest_xml.normalize_url(url))
1148
1149 url = "git@foo.com/baf/bat"
1150 self.assertEqual(url, manifest_xml.normalize_url(url))
1151
1152 url = "/file/path/here"
1153 self.assertEqual(url, manifest_xml.normalize_url(url))
1154
1155 def test_has_no_scheme_matches_scp_like_syntax(self):
1156 url = "git@foo.com:bar/baf"
1157 self.assertEqual(
1158 "ssh://git@foo.com/bar/baf", manifest_xml.normalize_url(url)
1159 )