mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-15 06:44:16 +00:00
[tests] Make shib test pass
This commit is contained in:
@@ -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 += (
|
||||
|
@@ -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
|
||||
|
@@ -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.
|
||||
|
Reference in New Issue
Block a user