1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-15 14:49:09 +00:00

[tests] Make shib test pass

This commit is contained in:
zhengxie
2016-03-24 16:58:55 +08:00
parent 65a336f573
commit f43cdb3f35
3 changed files with 7 additions and 12 deletions

View File

@@ -32,16 +32,11 @@ SAMPLE_HEADERS = {
} }
settings.SHIBBOLETH_ATTRIBUTE_MAP = { settings.SHIBBOLETH_ATTRIBUTE_MAP = {
"Shib-Identity-Provider": (True, "idp"), # "eppn": (True, "username"),
"Shibboleth-mail": (True, "email"), "givenname": (False, "givenname"),
"Shibboleth-eppn": (True, "username"), "surname": (False, "surname"),
"Shibboleth-schoolStatus": (True, "status"), "emailaddress": (False, "contact_email"),
"Shibboleth-affiliation": (True, "affiliation"), "organization": (False, "institution"),
"Shib-Session-ID": (True, "session_id"),
"Shibboleth-givenName": (True, "first_name"),
"Shibboleth-sn": (True, "last_name"),
"Shibboleth-mail": (True, "email"),
"Shibboleth-schoolBarCode": (False, "barcode")
} }
settings.AUTHENTICATION_BACKENDS += ( settings.AUTHENTICATION_BACKENDS += (

View File

@@ -52,7 +52,7 @@ class ShibbolethRemoteUserMiddlewareTest(BaseTestCase):
reload(backends) reload(backends)
resp = self.middleware.process_request(self.request) resp = self.middleware.process_request(self.request)
assert resp.status_code == 302 assert resp.url == 'shib-complete'
assert len(Profile.objects.all()) == 0 assert len(Profile.objects.all()) == 0
# now reload again, so it reverts to original settings # now reload again, so it reverts to original settings

View File

@@ -67,7 +67,7 @@ class ShibbolethRemoteUserMiddleware(RemoteUserMiddleware):
user = auth.authenticate(remote_user=username, shib_meta=shib_meta) user = auth.authenticate(remote_user=username, shib_meta=shib_meta)
if user: if user:
if not user.is_active: if not user.is_active:
return HttpResponseRedirect(reverse('shib_complete')) return HttpResponseRedirect('shib-complete')
# User is valid. Set request.user and persist user in the session # User is valid. Set request.user and persist user in the session
# by logging the user in. # by logging the user in.