Commit a268f327 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

astakos oa2: Fix further unicode issues

parent cab39ed2
...@@ -46,6 +46,7 @@ from django.http import HttpResponseNotAllowed ...@@ -46,6 +46,7 @@ from django.http import HttpResponseNotAllowed
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from synnefo.lib import join_urls from synnefo.lib import join_urls
from synnefo.util.text import uenc
import logging import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -120,7 +121,7 @@ class DjangoBackend(DjangoBackendORMMixin, oa2base.SimpleBackend, ...@@ -120,7 +121,7 @@ class DjangoBackend(DjangoBackendORMMixin, oa2base.SimpleBackend,
response.status_code = oa2response.status response.status_code = oa2response.status
response.content = oa2response.body response.content = oa2response.body
for key, value in oa2response.headers.iteritems(): for key, value in oa2response.headers.iteritems():
response[key] = value response[uenc(key)] = uenc(value)
return response return response
def build_request(self, django_request): def build_request(self, django_request):
......
...@@ -105,7 +105,7 @@ class URLAssertionsMixin(object): ...@@ -105,7 +105,7 @@ class URLAssertionsMixin(object):
@parsed_url_wrapper @parsed_url_wrapper
def assertPath(self, url, path): def assertPath(self, url, path):
self.assertEqual(url.path, path) self.assertEqual(normalize(url.path), normalize(path))
@parsed_url_wrapper @parsed_url_wrapper
def assertSecure(self, url, key): def assertSecure(self, url, key):
...@@ -385,7 +385,7 @@ class TestOA2(TestCase, URLAssertionsMixin): ...@@ -385,7 +385,7 @@ class TestOA2(TestCase, URLAssertionsMixin):
self.assertEqual(code.redirect_uri, self.client3_redirect_uri) self.assertEqual(code.redirect_uri, self.client3_redirect_uri)
# redirect uri startswith the client's registered redirect url # redirect uri startswith the client's registered redirect url
params['redirect_uri'] = '%smore' % self.client3_redirect_uri params['redirect_uri'] = '%sφωτογραφία.JPG' % self.client3_redirect_uri
self.client.set_credentials('client3', 'secret') self.client.set_credentials('client3', 'secret')
r = self.client.authorize_code('client3', urlparams=params) r = self.client.authorize_code('client3', urlparams=params)
self.assertEqual(r.status_code, 400) self.assertEqual(r.status_code, 400)
...@@ -419,7 +419,7 @@ class TestOA2(TestCase, URLAssertionsMixin): ...@@ -419,7 +419,7 @@ class TestOA2(TestCase, URLAssertionsMixin):
self.assertEqual(r.status_code, 400) self.assertEqual(r.status_code, 400)
# redirect uri descendant # redirect uri descendant
redirect_uri = '%s/more?α=γιουνικοντ' % self.client3_redirect_uri redirect_uri = '%s/φωτογραφία.JPG?α=γιουνικοντ' % self.client3_redirect_uri
params['redirect_uri'] = redirect_uri params['redirect_uri'] = redirect_uri
self.client.set_credentials('client3', 'secret') self.client.set_credentials('client3', 'secret')
r = self.client.authorize_code('client3', urlparams=params) r = self.client.authorize_code('client3', urlparams=params)
...@@ -553,7 +553,7 @@ class TestOA2(TestCase, URLAssertionsMixin): ...@@ -553,7 +553,7 @@ class TestOA2(TestCase, URLAssertionsMixin):
'state': None} 'state': None}
self.assert_access_token_response(r, expected) self.assert_access_token_response(r, expected)
redirect_uri = '%s/more?α=γιουνικοντ' % self.client3_redirect_uri redirect_uri = '%s/φωτογραφία.JPG?α=γιουνικοντ' % self.client3_redirect_uri
params = {'redirect_uri': redirect_uri} params = {'redirect_uri': redirect_uri}
r = self.client.authorize_code('client3', urlparams=params) r = self.client.authorize_code('client3', urlparams=params)
self.assertCount(AuthorizationCode, 1) self.assertCount(AuthorizationCode, 1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment