summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorj0hnsmith <info@whywouldwe.com>2015-08-21 18:20:30 +0100
committerj0hnsmith <info@whywouldwe.com>2015-08-21 18:20:30 +0100
commit94341f5f97bc20e1648f9d02a03be5a4bf075db6 (patch)
treeb8d4d5e723aeb6202f4aba309a6ec9728b7c2a9e
parent21d381f45d278e3049515a82a65608aadf07a289 (diff)
downloadpython-requests-aws-94341f5f97bc20e1648f9d02a03be5a4bf075db6.tar.gz
add test to ensure canonical string doesn't contain escaped params
-rw-r--r--test.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test.py b/test.py
index 9d7b3fc..ce38e68 100644
--- a/test.py
+++ b/test.py
@@ -126,5 +126,24 @@ class TestAWS(unittest.TestCase):
# No Delete ?notification API, empty <NotificationConfiguration>
# tag is default
+ def test_canonical_string_not_using_encoded_query_params(self):
+ url = 'https://bucket.ca.tier3.io/object-name?partNumber=1&uploadId=TFDSheOgTxC2Tsh1qVK73A%3D%3D'
+ headers = {
+ 'Content-Length': 0,
+ 'Accept-Encoding': 'gzip, deflate',
+ 'Accept': '*/*',
+ 'User-Agent': 'python-requests/2.7.0 CPython/2.7.6 Linux/3.13.0-24-generic',
+ 'Connection': 'keep-alive',
+ 'date': 'Fri, 21 Aug 2015 16:08:26 GMT',
+ }
+ method = 'PUT'
+ canonical_string = self.auth.get_canonical_string(url, headers, method)
+ self.assertTrue('TFDSheOgTxC2Tsh1qVK73A%3D%3D' not in canonical_string)
+ self.assertTrue('TFDSheOgTxC2Tsh1qVK73A==' in canonical_string)
+
+ url = 'https://bucket.ca.tier3.io/object-name?partNumber=1&uploadId=not%escaped'
+ canonical_string = self.auth.get_canonical_string(url, headers, method)
+ self.assertTrue('not%escaped' in canonical_string)
+
if __name__ == '__main__':
unittest.main()