Skip to content

Commit

Permalink
tests: add a check that we can deal with encoded colon and comma in s…
Browse files Browse the repository at this point in the history
…ystem capabilities (mozilla-releng#2803)

Bug 1620327 wants to encode the update URL properly, so let's make sure it works.

As far as I can tell this doesn't require changes to the application
code, because the CGI and wsgi specs say PATH_INFO is not URL-encoded,
so we don't have to deal with this at all.
  • Loading branch information
jcristau authored Jun 5, 2023
1 parent 2f77d4e commit 7110dc5
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/web/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,19 @@ def testVersion6GetWithLessThanEqualToMemory(self):
<patch type="complete" URL="http://a.com/f" hashFunction="sha512" hashValue="34" size="33"/>
</update>
</updates>
""",
)

def testVersion6GetWithLessThanEqualToMemoryEncoded(self):
ret = self.client.get("/update/6/f/1.0/1/p/l/a/a/ISET%3aSSE3%2cMEM%3a8000/a/a/update.xml")
self.assertUpdateEqual(
ret,
"""<?xml version="1.0"?>
<updates>
<update type="minor" version="1.0" extensionVersion="1.0" buildID="35">
<patch type="complete" URL="http://a.com/f" hashFunction="sha512" hashValue="34" size="33"/>
</update>
</updates>
""",
)

Expand All @@ -1125,6 +1138,19 @@ def testVersion6GetWithExactMemory(self):
<patch type="complete" URL="http://a.com/f" hashFunction="sha512" hashValue="34" size="33"/>
</update>
</updates>
""",
)

def testVersion6GetWithExactMemoryEncoded(self):
ret = self.client.get("/update/6/f/1.0/1/p/l/b/a/ISET%3aSSE3%2cMEM%3a9000/a/a/update.xml")
self.assertUpdateEqual(
ret,
"""<?xml version="1.0"?>
<updates>
<update type="minor" version="1.0" extensionVersion="1.0" buildID="35">
<patch type="complete" URL="http://a.com/f" hashFunction="sha512" hashValue="34" size="33"/>
</update>
</updates>
""",
)

Expand All @@ -1138,6 +1164,19 @@ def testVersion6GetWithGreaterThanMemory(self):
<patch type="complete" URL="http://a.com/f" hashFunction="sha512" hashValue="34" size="33"/>
</update>
</updates>
""",
)

def testVersion6GetWithGreaterThanMemoryEncoded(self):
ret = self.client.get("/update/6/f/1.0/1/p/l/c/a/ISET%3aSSE3%2cMEM%3a11000/a/a/update.xml")
self.assertUpdateEqual(
ret,
"""<?xml version="1.0"?>
<updates>
<update type="minor" version="1.0" extensionVersion="1.0" buildID="35">
<patch type="complete" URL="http://a.com/f" hashFunction="sha512" hashValue="34" size="33"/>
</update>
</updates>
""",
)

Expand Down

0 comments on commit 7110dc5

Please sign in to comment.