forked from Github-Mirrors/canaille
unit tests: only use user_name to authenticate users
This commit is contained in:
parent
70193b3409
commit
abf9a23ac8
6 changed files with 18 additions and 18 deletions
|
@ -85,7 +85,7 @@ def configuration(slapd_server, smtpd):
|
|||
"BIND_DN": slapd_server.root_dn,
|
||||
"BIND_PW": slapd_server.root_pw,
|
||||
"USER_BASE": "ou=users",
|
||||
"USER_FILTER": "(|(uid={login})(cn={login}))",
|
||||
"USER_FILTER": "(uid={login})",
|
||||
"GROUP_BASE": "ou=groups",
|
||||
"TIMEOUT": 0.1,
|
||||
},
|
||||
|
|
|
@ -27,12 +27,12 @@ def test_signin_and_out(testclient, user):
|
|||
|
||||
res = testclient.get("/login", status=200)
|
||||
|
||||
res.form["login"] = "John (johnny) Doe"
|
||||
res.form["login"] = "user"
|
||||
res = res.form.submit(status=302)
|
||||
res = res.follow(status=200)
|
||||
|
||||
with testclient.session_transaction() as session:
|
||||
assert "John (johnny) Doe" == session.get("attempt_login")
|
||||
assert "user" == session.get("attempt_login")
|
||||
|
||||
res.form["password"] = "correct horse battery staple"
|
||||
res = res.form.submit()
|
||||
|
@ -76,7 +76,7 @@ def test_signin_wrong_password(testclient, user):
|
|||
|
||||
res = testclient.get("/login", status=200)
|
||||
|
||||
res.form["login"] = "John (johnny) Doe"
|
||||
res.form["login"] = "user"
|
||||
res = res.form.submit(status=302)
|
||||
res = res.follow(status=200)
|
||||
res.form["password"] = "incorrect horse"
|
||||
|
@ -116,7 +116,7 @@ def test_user_without_password_first_login(testclient, slapd_connection, smtpd):
|
|||
u.save()
|
||||
|
||||
res = testclient.get("/login", status=200)
|
||||
res.form["login"] = "Temp User"
|
||||
res.form["login"] = "temp"
|
||||
res = res.form.submit(status=302)
|
||||
|
||||
assert res.location == "/firstlogin/temp"
|
||||
|
@ -195,7 +195,7 @@ def test_user_password_deleted_during_login(testclient, slapd_connection):
|
|||
u.save()
|
||||
|
||||
res = testclient.get("/login")
|
||||
res.form["login"] = "Temp User"
|
||||
res.form["login"] = "temp"
|
||||
res = res.form.submit().follow()
|
||||
res.form["password"] = "correct horse battery staple"
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ def test_unavailable_if_no_smtp(testclient, user):
|
|||
res = testclient.get("/login")
|
||||
res.mustcontain("Forgotten password")
|
||||
|
||||
res.form["login"] = "John (johnny) Doe"
|
||||
res.form["login"] = "user"
|
||||
res = res.form.submit()
|
||||
res = res.follow()
|
||||
res.mustcontain("Forgotten password")
|
||||
|
@ -57,7 +57,7 @@ def test_unavailable_if_no_smtp(testclient, user):
|
|||
res = testclient.get("/login")
|
||||
res.mustcontain(no="Forgotten password")
|
||||
|
||||
res.form["login"] = "John (johnny) Doe"
|
||||
res.form["login"] = "user"
|
||||
res = res.form.submit()
|
||||
res = res.follow()
|
||||
res.mustcontain(no="Forgotten password")
|
||||
|
|
|
@ -239,12 +239,12 @@ def test_logout_login(testclient, logged_user, client):
|
|||
res = res.form.submit(name="answer", value="logout", status=302)
|
||||
res = res.follow(status=200)
|
||||
|
||||
res.form["login"] = logged_user.formatted_name[0]
|
||||
res.form["login"] = logged_user.user_name[0]
|
||||
res.form["password"] = "wrong password"
|
||||
res = res.form.submit(status=200)
|
||||
assert ("error", "Login failed, please check your information") in res.flashes
|
||||
|
||||
res.form["login"] = logged_user.formatted_name[0]
|
||||
res.form["login"] = logged_user.user_name[0]
|
||||
res.form["password"] = "correct horse battery staple"
|
||||
res = res.form.submit(status=302)
|
||||
res = res.follow(status=200)
|
||||
|
@ -326,7 +326,7 @@ def test_refresh_token(testclient, user, client):
|
|||
status=200,
|
||||
)
|
||||
|
||||
res.form["login"] = "John (johnny) Doe"
|
||||
res.form["login"] = "user"
|
||||
res.form["password"] = "correct horse battery staple"
|
||||
res = res.form.submit(name="answer", value="accept", status=302)
|
||||
res = res.follow()
|
||||
|
@ -595,7 +595,7 @@ def test_authorization_code_flow_but_user_cannot_use_oidc(
|
|||
status=200,
|
||||
)
|
||||
|
||||
res.form["login"] = "John (johnny) Doe"
|
||||
res.form["login"] = "user"
|
||||
res = res.form.submit(status=200)
|
||||
|
||||
res.form["password"] = "correct horse battery staple"
|
||||
|
@ -787,7 +787,7 @@ def test_authorization_code_expired(testclient, user, client):
|
|||
),
|
||||
status=200,
|
||||
)
|
||||
res.form["login"] = "John (johnny) Doe"
|
||||
res.form["login"] = "user"
|
||||
res.form["password"] = "correct horse battery staple"
|
||||
res = res.form.submit(name="answer", value="accept").follow()
|
||||
res = res.form.submit(name="answer", value="accept", status=302)
|
||||
|
@ -832,7 +832,7 @@ def test_code_with_invalid_user(testclient, admin, client):
|
|||
),
|
||||
status=200,
|
||||
)
|
||||
res.form["login"] = "Temp"
|
||||
res.form["login"] = "temp"
|
||||
res.form["password"] = "correct horse battery staple"
|
||||
res = res.form.submit(name="answer", value="accept", status=302).follow()
|
||||
res = res.form.submit(name="answer", value="accept", status=302)
|
||||
|
@ -881,7 +881,7 @@ def test_refresh_token_with_invalid_user(testclient, client):
|
|||
status=200,
|
||||
)
|
||||
|
||||
res.form["login"] = "Temp"
|
||||
res.form["login"] = "temp"
|
||||
res.form["password"] = "correct horse battery staple"
|
||||
res = res.form.submit(name="answer", value="accept", status=302).follow()
|
||||
res = res.form.submit(name="answer", value="accept", status=302)
|
||||
|
|
|
@ -19,7 +19,7 @@ def test_oauth_hybrid(testclient, slapd_connection, user, client):
|
|||
)
|
||||
assert "text/html" == res.content_type, res.json
|
||||
|
||||
res.form["login"] = user.formatted_name[0]
|
||||
res.form["login"] = user.user_name[0]
|
||||
res.form["password"] = "correct horse battery staple"
|
||||
res = res.form.submit(status=302)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ def test_password_flow_basic(testclient, user, client):
|
|||
"/oauth/token",
|
||||
params=dict(
|
||||
grant_type="password",
|
||||
username="John (johnny) Doe",
|
||||
username="user",
|
||||
password="correct horse battery staple",
|
||||
scope="openid profile groups",
|
||||
),
|
||||
|
@ -39,7 +39,7 @@ def test_password_flow_post(testclient, user, client):
|
|||
"/oauth/token",
|
||||
params=dict(
|
||||
grant_type="password",
|
||||
username="John (johnny) Doe",
|
||||
username="user",
|
||||
password="correct horse battery staple",
|
||||
scope="openid profile groups",
|
||||
client_id=client.client_id,
|
||||
|
|
Loading…
Reference in a new issue