2021-12-06 20:49:38 +00:00
|
|
|
def test_ldap_connection_remote_ldap_unreachable(testclient):
|
2022-05-08 14:31:17 +00:00
|
|
|
testclient.app.config["TESTING"] = False
|
|
|
|
|
2021-12-06 20:49:38 +00:00
|
|
|
testclient.app.config["LDAP"]["URI"] = "ldap://invalid-ldap.com"
|
|
|
|
|
|
|
|
testclient.app.config["DEBUG"] = True
|
|
|
|
res = testclient.get("/", status=500, expect_errors=True)
|
2023-03-16 15:25:14 +00:00
|
|
|
res.mustcontain("Could not connect to the LDAP server")
|
2021-12-06 20:49:38 +00:00
|
|
|
|
|
|
|
testclient.app.config["DEBUG"] = False
|
|
|
|
res = testclient.get("/", status=500, expect_errors=True)
|
2023-03-16 15:25:14 +00:00
|
|
|
res.mustcontain(no="Could not connect to the LDAP server")
|
2021-12-06 20:49:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_ldap_connection_remote_ldap_wrong_credentials(testclient):
|
2022-05-08 14:31:17 +00:00
|
|
|
testclient.app.config["TESTING"] = False
|
|
|
|
|
2021-12-06 20:49:38 +00:00
|
|
|
testclient.app.config["LDAP"]["BIND_PW"] = "invalid-password"
|
|
|
|
|
|
|
|
testclient.app.config["DEBUG"] = True
|
|
|
|
res = testclient.get("/", status=500, expect_errors=True)
|
2023-03-16 15:25:14 +00:00
|
|
|
res.mustcontain("LDAP authentication failed with user")
|
2021-12-06 20:49:38 +00:00
|
|
|
|
|
|
|
testclient.app.config["DEBUG"] = False
|
|
|
|
res = testclient.get("/", status=500, expect_errors=True)
|
2023-03-16 15:25:14 +00:00
|
|
|
res.mustcontain(no="LDAP authentication failed with user")
|