Commit 5b890f44 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

astakos: Auth provider presentation fix

prevent encoding errors
parent e9045cb3
...@@ -263,11 +263,11 @@ class AuthProvider(object): ...@@ -263,11 +263,11 @@ class AuthProvider(object):
return create return create
def __repr__(self): def __repr__(self):
r = "'%s' module" % self.__class__.__name__ r = "'%r' module" % self.__class__.__name__
if self.user: if self.user:
r += ' (user: %s)' % self.user r += ' (user: %r)' % self.user
if self.identifier: if self.identifier:
r += '(identifier: %s)' % self.identifier r += '(identifier: %r)' % self.identifier
return r return r
def _message_params(self, **extra_params): def _message_params(self, **extra_params):
......
...@@ -791,6 +791,7 @@ class TestAuthProviderViews(TestCase): ...@@ -791,6 +791,7 @@ class TestAuthProviderViews(TestCase):
@shibboleth_settings(CREATION_GROUPS_POLICY=['academic-login'], @shibboleth_settings(CREATION_GROUPS_POLICY=['academic-login'],
AUTOMODERATE_POLICY=True) AUTOMODERATE_POLICY=True)
@im_settings(IM_MODULES=['shibboleth', 'local'], MODERATION_ENABLED=True, @im_settings(IM_MODULES=['shibboleth', 'local'], MODERATION_ENABLED=True,
HELPDESK=(('support', 'support@synnefo.org'),),
FORCE_PROFILE_UPDATE=False) FORCE_PROFILE_UPDATE=False)
def test_user(self): def test_user(self):
Profile = AuthProviderPolicyProfile Profile = AuthProviderPolicyProfile
...@@ -818,8 +819,8 @@ class TestAuthProviderViews(TestCase): ...@@ -818,8 +819,8 @@ class TestAuthProviderViews(TestCase):
# new academic user # new academic user
self.assertFalse(academic_users.filter(email='newuser@synnefo.org')) self.assertFalse(academic_users.filter(email='newuser@synnefo.org'))
cl_newuser.set_tokens(remote_user="newusereppn", mail="newuser@synnefo.org", cl_newuser.set_tokens(remote_user="newusereppn",
surname="Lastname") mail="newuser@synnefo.org", surname="Lastname")
r = cl_newuser.get(ui_url('login/shibboleth?'), follow=True) r = cl_newuser.get(ui_url('login/shibboleth?'), follow=True)
initial = r.context['signup_form'].initial initial = r.context['signup_form'].initial
pending = Pending.objects.get() pending = Pending.objects.get()
...@@ -869,7 +870,7 @@ class TestAuthProviderViews(TestCase): ...@@ -869,7 +870,7 @@ class TestAuthProviderViews(TestCase):
pending = Pending.objects.get() pending = Pending.objects.get()
identifier = pending.third_party_identifier identifier = pending.third_party_identifier
signup_data = {'third_party_identifier': identifier, signup_data = {'third_party_identifier': identifier,
'first_name': 'Academic', u'first_name': 'Academic γιούνικοουντ',
'third_party_token': pending.token, 'third_party_token': pending.token,
'last_name': 'New User', 'last_name': 'New User',
'provider': 'shibboleth'} 'provider': 'shibboleth'}
...@@ -882,6 +883,10 @@ class TestAuthProviderViews(TestCase): ...@@ -882,6 +883,10 @@ class TestAuthProviderViews(TestCase):
self.assertTrue(academic_users.get(email='newuser@synnefo.org')) self.assertTrue(academic_users.get(email='newuser@synnefo.org'))
r = cl_newuser.get(newuser.get_activation_url(), follow=True) r = cl_newuser.get(newuser.get_activation_url(), follow=True)
self.assertRedirects(r, ui_url('landing')) self.assertRedirects(r, ui_url('landing'))
helpdesk_email = astakos_settings.HELPDESK[0][1]
self.assertEqual(len(get_mailbox(helpdesk_email)), 1)
self.assertTrue(u'AstakosUser: Academic γιούνικοουντ' in \
get_mailbox(helpdesk_email)[0].body)
newuser = User.objects.get(email="newuser@synnefo.org") newuser = User.objects.get(email="newuser@synnefo.org")
self.assertEqual(newuser.is_active, True) self.assertEqual(newuser.is_active, True)
self.assertEqual(newuser.email_verified, True) self.assertEqual(newuser.email_verified, True)
......
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