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 = {
"Shib-Identity-Provider": (True, "idp"),
"Shibboleth-mail": (True, "email"),
"Shibboleth-eppn": (True, "username"),
"Shibboleth-schoolStatus": (True, "status"),
"Shibboleth-affiliation": (True, "affiliation"),
"Shib-Session-ID": (True, "session_id"),
"Shibboleth-givenName": (True, "first_name"),
"Shibboleth-sn": (True, "last_name"),
"Shibboleth-mail": (True, "email"),
"Shibboleth-schoolBarCode": (False, "barcode")
# "eppn": (True, "username"),
"givenname": (False, "givenname"),
"surname": (False, "surname"),
"emailaddress": (False, "contact_email"),
"organization": (False, "institution"),
}
settings.AUTHENTICATION_BACKENDS += (

View File

@@ -52,7 +52,7 @@ class ShibbolethRemoteUserMiddlewareTest(BaseTestCase):
reload(backends)
resp = self.middleware.process_request(self.request)
assert resp.status_code == 302
assert resp.url == 'shib-complete'
assert len(Profile.objects.all()) == 0
# 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)
if user:
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
# by logging the user in.