cubicweb/server/test/unittest_ldapsource.py
branch3.23
changeset 11719 36443c44b9a5
parent 11718 e32e328e7d1f
child 11755 96ced95e4002
--- a/cubicweb/server/test/unittest_ldapsource.py	Wed Oct 19 15:56:35 2016 +0200
+++ b/cubicweb/server/test/unittest_ldapsource.py	Wed Oct 19 15:57:52 2016 +0200
@@ -311,6 +311,24 @@
             self.assertTrue(str(pwd))
 
 
+class LDAPGeneratePwdTC(LDAPFeedTestBase):
+    """
+    A testcase for password generation on CWUser when none is imported
+    """
+
+    def setup_database(self):
+        with self.admin_access.repo_cnx() as cnx:
+            lfsource = cnx.repo.sources_by_uri['ldap']
+            del lfsource.user_attrs['userPassword']
+        super(LDAPGeneratePwdTC, self).setup_database()
+
+    def test_no_password(self):
+        with self.admin_access.repo_cnx() as cnx:
+            cu = cnx.system_sql("SELECT cw_upassword FROM cw_cwuser WHERE cw_login='syt';")
+            pwd = cu.fetchall()[0][0]
+            self.assertTrue(pwd)
+
+
 class LDAPFeedUserDeletionTC(LDAPFeedTestBase):
     """
     A testcase for situations where users are deleted from or