summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2016-03-08 15:28:42 +0530
committerThiago da Silva <thiago@redhat.com>2016-03-15 06:05:41 -0700
commit5078be08017a21d97a3cf3fa2ffe554ad7f3d2c9 (patch)
tree21cdb24cd9c2fde4f8a8a5ff9d7d26682a2b3ae0 /test/unit
parent9b42f6f85b076202055bb90820db3499cc6015e5 (diff)
Don't pass unicode to hmac.new()
This issue can be hit when swift3 middleware is in the pipeline. This change is a backport of the following swauth change: https://review.openstack.org/#/c/282191/ Change-Id: I323d3eeaf39e2019f8f8910bc53904ac94208ed2 Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on: http://review.gluster.org/13641 Reviewed-by: Thiago da Silva <thiago@redhat.com> Tested-by: Thiago da Silva <thiago@redhat.com>
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/common/middleware/gswauth/swauth/test_middleware.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/common/middleware/gswauth/swauth/test_middleware.py b/test/unit/common/middleware/gswauth/swauth/test_middleware.py
index 668f266..67abbe4 100644
--- a/test/unit/common/middleware/gswauth/swauth/test_middleware.py
+++ b/test/unit/common/middleware/gswauth/swauth/test_middleware.py
@@ -4791,6 +4791,20 @@ class TestAuth(unittest.TestCase):
self.assertEquals(resp.environ['swift.authorize'],
self.test_auth.denied_response)
+ def test_s3_creds_unicode(self):
+ self.test_auth.app = FakeApp(iter([
+ ('200 Ok', {},
+ json.dumps({"auth": unicode("plaintext:key)"),
+ "groups": [{'name': "act:usr"}, {'name': "act"},
+ {'name': ".admin"}]})),
+ ('204 Ok', {'X-Container-Meta-Account-Id': 'AUTH_act'}, '')]))
+ env = \
+ {'HTTP_AUTHORIZATION': 'AWS act:user:3yW7oFFWOn+fhHMu7E47RKotL1Q=',
+ 'PATH_INFO': '/v1/AUTH_act/c1'}
+ token = 'UFVUCgoKRnJpLCAyNiBGZWIgMjAxNiAwNjo0NT'\
+ 'ozNCArMDAwMAovY29udGFpbmVyMw=='
+ self.assertEqual(self.test_auth.get_groups(env, token), None)
+
if __name__ == '__main__':
unittest.main()