canaille-globuzma/tests/oidc/test_account.py
2024-03-28 17:44:26 +01:00

20 lines
601 B
Python

from flask import g
def test_index(testclient, user):
res = testclient.get("/", status=302)
assert res.location == "/login"
g.user = user
res = testclient.get("/", status=302)
assert res.location == "/profile/user"
testclient.app.config["CANAILLE"]["ACL"]["DEFAULT"]["PERMISSIONS"] = ["use_oidc"]
g.user.reload()
res = testclient.get("/", status=302)
assert res.location == "/consent/"
testclient.app.config["CANAILLE"]["ACL"]["DEFAULT"]["PERMISSIONS"] = []
g.user.reload()
res = testclient.get("/", status=302)
assert res.location == "/about"