Created
July 1, 2016 06:28
-
-
Save clayg/de2282be944d5ceee5c511e327320242 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/test/unit/common/middleware/crypto/test_decrypter.py b/test/unit/common/middleware/crypto/test_decrypter.py | |
index ee5830f..b70d650 100644 | |
--- a/test/unit/common/middleware/crypto/test_decrypter.py | |
+++ b/test/unit/common/middleware/crypto/test_decrypter.py | |
@@ -121,6 +121,37 @@ class TestDecrypterObjectRequests(unittest.TestCase): | |
resp = self._test_request_success('HEAD', body) | |
self.assertEqual('', resp.body) | |
+ def test_headers_case(self): | |
+ body = 'fAkE ApP' | |
+ req = Request.blank('/v1/a/c/o', body='FaKe') | |
+ req.environ[CRYPTO_KEY_CALLBACK] = fetch_crypto_keys | |
+ plaintext_etag = md5hex(body) | |
+ body_key = os.urandom(32) | |
+ enc_body = encrypt(body, body_key, FAKE_IV) | |
+ hdrs = self._make_response_headers( | |
+ len(enc_body), plaintext_etag, fetch_crypto_keys(), body_key) | |
+ | |
+ hdrs.update({ | |
+ 'x-Object-mEta-ignoRes-caSe': 'thIs pArt WilL bE cOol', | |
+ }) | |
+ self.app.register( | |
+ 'GET', '/v1/a/c/o', HTTPOk, body=enc_body, headers=hdrs) | |
+ | |
+ status, headers, app_iter = req.call_application(self.decrypter) | |
+ self.assertEqual(status, '200 OK') | |
+ expected = { | |
+ 'Etag': '7f7837924188f7b511a9e3881a9f77a8', | |
+ 'X-Object-Sysmeta-Container-Update-Override-Etag': | |
+ 'encrypt me, too', | |
+ 'X-Object-Meta-Test': 'encrypt me', | |
+ 'Content-Length': '8', | |
+ 'X-Object-Meta-Ignores-Case': 'thIs pArt WilL bE cOol', | |
+ 'X-Object-Sysmeta-Test': 'do not encrypt me', | |
+ 'Content-Type': 'text/plain', | |
+ } | |
+ self.assertEqual(dict(headers), expected) | |
+ self.assertEqual('fAkE ApP', ''.join(app_iter)) | |
+ | |
def _test_412_response(self, method): | |
# simulate a 412 response to a conditional GET which has an Etag header | |
data = 'the object content' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test_headers_case (test.unit.common.middleware.crypto.test_decrypter.TestDecrypterObjectRequests) ... FAIL | |
====================================================================== | |
FAIL: test_headers_case (test.unit.common.middleware.crypto.test_decrypter.TestDecrypterObjectRequests) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/home/vagrant/swift/test/unit/common/middleware/crypto/test_decrypter.py", line 152, in test_headers_case | |
self.assertEqual(dict(headers), expected) | |
AssertionError: {'Content-Length': '8', 'x-object-meta-Test': 'encrypt me', 'X-Object-Meta-Ignor [truncated]... != {'Content-Length': '8', 'X-Object-Meta-Test': 'encrypt me', 'X-Object-Meta-Ignor [truncated]... | |
{'Content-Length': '8', | |
'Content-Type': 'text/plain', | |
'Etag': '7f7837924188f7b511a9e3881a9f77a8', | |
'X-Object-Meta-Ignores-Case': 'thIs pArt WilL bE cOol', | |
+ 'X-Object-Meta-Test': 'encrypt me', | |
'X-Object-Sysmeta-Container-Update-Override-Etag': 'encrypt me, too', | |
- 'X-Object-Sysmeta-Test': 'do not encrypt me', | |
? ^ | |
+ 'X-Object-Sysmeta-Test': 'do not encrypt me'} | |
? ^ | |
- 'x-object-meta-Test': 'encrypt me'} | |
---------------------------------------------------------------------- | |
Ran 1 test in 0.068s | |
FAILED (failures=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment