Revision 5bc77346 snf-astakos-app/astakos/im/tests/auth.py
b/snf-astakos-app/astakos/im/tests/auth.py | ||
---|---|---|
256 | 256 |
self.assertEqual(r.status_code, 200) |
257 | 257 |
|
258 | 258 |
# cannot add the same eppn |
259 |
client.set_tokens(mail="secondary@shibboleth.gr", remote_user="kpapeppn", |
|
259 |
client.set_tokens(mail="secondary@shibboleth.gr", |
|
260 |
remote_user="kpapeppn", |
|
260 | 261 |
cn="Kostas Papadimitriou", ) |
261 | 262 |
r = client.get(ui_url("login/shibboleth?"), follow=True) |
262 | 263 |
self.assertRedirects(r, ui_url('landing')) |
... | ... | |
264 | 265 |
self.assertEquals(existing_user.auth_providers.count(), 2) |
265 | 266 |
|
266 | 267 |
# only one allowed by default |
267 |
client.set_tokens(mail="secondary@shibboleth.gr", remote_user="kpapeppn2", |
|
268 |
client.set_tokens(mail="secondary@shibboleth.gr", |
|
269 |
remote_user="kpapeppn2", |
|
268 | 270 |
cn="Kostas Papadimitriou", ep_affiliation="affil2") |
269 | 271 |
prov = auth_providers.get_provider('shibboleth') |
270 | 272 |
r = client.get(ui_url("login/shibboleth?"), follow=True) |
... | ... | |
276 | 278 |
client.reset_tokens() |
277 | 279 |
|
278 | 280 |
# cannot login with another eppn |
279 |
client.set_tokens(mail="kpap@synnefo.org", remote_user="kpapeppninvalid", |
|
281 |
client.set_tokens(mail="kpap@synnefo.org", |
|
282 |
remote_user="kpapeppninvalid", |
|
280 | 283 |
cn="Kostas Papadimitriou") |
281 | 284 |
r = client.get(ui_url("login/shibboleth?"), follow=True) |
282 | 285 |
self.assertFalse(r.context['request'].user.is_authenticated()) |
... | ... | |
352 | 355 |
r = client.get(ui_url("login/shibboleth?"), follow=True) |
353 | 356 |
# try to assign existing shibboleth identifier of another user |
354 | 357 |
client.set_tokens(mail="kpap_second@shibboleth.gr", |
355 |
remote_user="existingeppn", cn="Kostas Papadimitriou") |
|
358 |
remote_user="existingeppn", |
|
359 |
cn="Kostas Papadimitriou") |
|
356 | 360 |
r = client.get(ui_url("login/shibboleth?"), follow=True) |
357 | 361 |
self.assertContains(r, "is already in use") |
358 | 362 |
|
... | ... | |
747 | 751 |
eppn_user.add_auth_provider('shibboleth', 'EPPN') |
748 | 752 |
tid_user.add_auth_provider('shibboleth', TEST_TARGETED_ID1) |
749 | 753 |
|
750 |
|
|
751 | 754 |
get_user = lambda r: r.context['request'].user |
752 | 755 |
|
753 | 756 |
client = ShibbolethClient() |
... | ... | |
757 | 760 |
self.assertEqual(eppn_user.get_auth_provider('shibboleth').identifier, |
758 | 761 |
TEST_TARGETED_ID2) |
759 | 762 |
|
760 |
|
|
761 | 763 |
client = ShibbolethClient() |
762 | 764 |
client.set_tokens(eppn="EPPN", remote_user=TEST_TARGETED_ID1) |
763 | 765 |
r = client.get(ui_url('login/shibboleth?'), follow=True) |
... | ... | |
765 | 767 |
self.assertEqual(tid_user.get_auth_provider('shibboleth').identifier, |
766 | 768 |
TEST_TARGETED_ID1) |
767 | 769 |
|
768 |
|
|
769 | 770 |
@shibboleth_settings(CREATION_GROUPS_POLICY=['academic-login'], |
770 | 771 |
AUTOMODERATE_POLICY=True) |
771 | 772 |
@im_settings(IM_MODULES=['shibboleth', 'local'], MODERATION_ENABLED=True, |
... | ... | |
796 | 797 |
|
797 | 798 |
# new academic user |
798 | 799 |
self.assertFalse(academic_users.filter(email='newuser@synnefo.org')) |
799 |
cl_newuser.set_tokens(remote_user="newusereppn", mail="newuser@synnefo.org", |
|
800 |
cl_newuser.set_tokens(remote_user="newusereppn", |
|
801 |
mail="newuser@synnefo.org", |
|
800 | 802 |
surname="Lastname") |
801 | 803 |
r = cl_newuser.get(ui_url('login/shibboleth?'), follow=True) |
802 | 804 |
initial = r.context['signup_form'].initial |
Also available in: Unified diff