mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
tests/sso: fix redirect test, gotta explicitly tell python to not follow 302s
This commit is contained in:
parent
61a43df169
commit
fc048f804e
1 changed files with 3 additions and 13 deletions
|
@ -81,26 +81,16 @@ def request(webpath, logged_as=None, session=None):
|
||||||
|
|
||||||
# Anonymous access
|
# Anonymous access
|
||||||
if session:
|
if session:
|
||||||
r = session.get(webpath, verify=False)
|
r = session.get(webpath, verify=False, allow_redirects=False)
|
||||||
elif not logged_as:
|
elif not logged_as:
|
||||||
r = requests.get(webpath, verify=False)
|
r = requests.get(webpath, verify=False, allow_redirects=False)
|
||||||
# Login as a user using dummy password
|
# Login as a user using dummy password
|
||||||
else:
|
else:
|
||||||
with requests.Session() as session:
|
with requests.Session() as session:
|
||||||
r = login(session, logged_as)
|
r = login(session, logged_as)
|
||||||
# We should have some cookies related to authentication now
|
# We should have some cookies related to authentication now
|
||||||
assert session.cookies
|
assert session.cookies
|
||||||
r = session.get(webpath, verify=False)
|
r = session.get(webpath, verify=False, allow_redirects=False)
|
||||||
|
|
||||||
# If we can't access it, we got redirected to the SSO
|
|
||||||
# with `r=<base64_callback_url>` for anonymous access because they're encouraged to log-in,
|
|
||||||
# and `msg=access_denied` if we are logged but not allowed for this url
|
|
||||||
# with `r=
|
|
||||||
#sso_url = f"https://{maindomain}/yunohost/sso/"
|
|
||||||
#if not logged_as:
|
|
||||||
# sso_url += "?r="
|
|
||||||
#else:
|
|
||||||
# sso_url += "?msg=access_denied"
|
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue