diff --git a/tests/test_sso.py b/tests/test_sso.py index e19fe4b..abf4f5d 100644 --- a/tests/test_sso.py +++ b/tests/test_sso.py @@ -13,11 +13,9 @@ from urlparse import urlparse, parse_qs from urllib import unquote - from pydiscourse import sso from pydiscourse.exceptions import DiscourseError - class SSOTestCase(unittest.TestCase): def setUp(self): # values from https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045 @@ -69,9 +67,12 @@ def test_valid_redirect_url(self): payload = unquote(payload) payload = dict((p.split('=') for p in payload.split('&'))) + decoded = base64.decodestring(payload) + qs = parse_qs(decoded) + self.assertEqual(payload, { 'username': self.username, - 'nonce': self.nonce, + 'nonce': qs['nonce'][0], 'external_id': self.external_id, 'name': self.name, 'email': self.email