diff --git a/test/src/ldap_server.py b/test/src/ldap_server.py index 710f04a6..e34f6f38 100644 --- a/test/src/ldap_server.py +++ b/test/src/ldap_server.py @@ -98,7 +98,22 @@ class LDAPServer: "posixAccount", "simpleSecurityObject", ], - "userPassword": ["yunohost"], + "userPassword": [self._hash_user_password("yunohost")], } ldap_interface.update("cn=admin", admin_dict) + + + def _hash_user_password(self, password): + """ + Copy pasta of what's in yunohost/user.py + """ + import string + import random + import crypt + + char_set = string.ascii_uppercase + string.ascii_lowercase + string.digits + "./" + salt = ''.join([random.SystemRandom().choice(char_set) for x in range(16)]) + + salt = '$6$' + salt + '$' + return '{CRYPT}' + crypt.crypt(str(password), salt) diff --git a/tox.ini b/tox.ini index 85021c0d..dc175f71 100644 --- a/tox.ini +++ b/tox.ini @@ -19,6 +19,7 @@ deps = gevent-websocket bottle >= 0.12 WebTest >= 2.0, < 2.1 + python-ldap >= 3.1.0 commands = pytest {posargs}