diff --git a/common/djangoapps/external_auth/tests/test_shib.py b/common/djangoapps/external_auth/tests/test_shib.py index 7880baef0c..3b9668aedc 100644 --- a/common/djangoapps/external_auth/tests/test_shib.py +++ b/common/djangoapps/external_auth/tests/test_shib.py @@ -5,6 +5,7 @@ Tests for Shibboleth Authentication """ import unittest from mock import patch +from ddt import ddt, data from django.conf import settings from django.http import HttpResponseRedirect @@ -74,6 +75,7 @@ def gen_all_identities(): yield _build_identity_dict(mail, display_name, given_name, surname) +@ddt @override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE, SESSION_ENGINE='django.contrib.sessions.backends.cache') class ShibSPTest(ModuleStoreTestCase): """ @@ -271,37 +273,35 @@ class ShibSPTest(ModuleStoreTestCase): self._base_test_extauth_auto_activate_user_with_flag(log_user_string="user.id: 1") @unittest.skipUnless(settings.FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set") - def test_registration_form(self): + @data(*gen_all_identities()) + def test_registration_form(self, identity): """ Tests the registration form showing up with the proper parameters. Uses django test client for its session support """ - for identity in gen_all_identities(): - client = DjangoTestClient() - # identity k/v pairs will show up in request.META - response = client.get(path='/shib-login/', data={}, follow=False, **identity) + client = DjangoTestClient() + # identity k/v pairs will show up in request.META + response = client.get(path='/shib-login/', data={}, follow=False, **identity) - self.assertEquals(response.status_code, 200) - mail_input_HTML = '