mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
test auth ldap
This commit is contained in:
parent
142081a934
commit
88cdeb0b96
4 changed files with 31 additions and 1 deletions
|
@ -13,6 +13,13 @@ _global:
|
|||
yoloswag:
|
||||
vendor: dummy
|
||||
help: Dummy Yoloswag Password
|
||||
ldap:
|
||||
vendor: ldap
|
||||
help: admin_password
|
||||
parameters:
|
||||
uri: ldap://localhost:8080
|
||||
base_dn: dc=yunohost,dc=org
|
||||
user_rdn: cn=admin,dc=yunohost,dc=org
|
||||
arguments:
|
||||
-v:
|
||||
full: --version
|
||||
|
@ -54,6 +61,13 @@ testauth:
|
|||
- all
|
||||
authenticator: yoloswag
|
||||
|
||||
ldap:
|
||||
api: GET /test-auth/ldap
|
||||
configuration:
|
||||
authenticate:
|
||||
- all
|
||||
authenticator: ldap
|
||||
|
||||
subcategories:
|
||||
subcat:
|
||||
actions:
|
||||
|
|
|
@ -32,3 +32,7 @@ def testauth_only_api():
|
|||
|
||||
def testauth_only_cli():
|
||||
return "some_data_from_only_cli"
|
||||
|
||||
|
||||
def testauth_ldap():
|
||||
return "some_data_from_ldap"
|
||||
|
|
|
@ -158,6 +158,18 @@ class TestAuthAPI:
|
|||
== "Authentication required"
|
||||
)
|
||||
|
||||
def test_login_ldap(self, moulinette_webapi, ldap_server, mocker):
|
||||
mocker.patch(
|
||||
"moulinette.authenticators.ldap.Authenticator._get_uri",
|
||||
return_value=ldap_server.uri,
|
||||
)
|
||||
self.login(moulinette_webapi, profile="ldap", password="yunohost")
|
||||
|
||||
assert (
|
||||
moulinette_webapi.get("/test-auth/ldap", status=200).text
|
||||
== '"some_data_from_ldap"'
|
||||
)
|
||||
|
||||
|
||||
class TestAuthCLI:
|
||||
def test_login(self, moulinette_cli, capsys, mocker):
|
||||
|
|
|
@ -11,7 +11,7 @@ class TestLDAP:
|
|||
self.ldap_conf = {
|
||||
"vendor": "ldap",
|
||||
"name": "as-root",
|
||||
"parameters": {"base_dn": "dc=yunohost,dc=org",},
|
||||
"parameters": {"base_dn": "dc=yunohost,dc=org"},
|
||||
"extra": {},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue