From aa0ba6dd1bd8e45e032462602390bc721a40030f Mon Sep 17 00:00:00 2001
From: Sistason <c3infra@sistason.de>
Date: Tue, 6 Apr 2021 14:37:01 +0200
Subject: [PATCH] change init import to better compatible with the rest of the
 code

---
 tests/test_user.py | 2 +-
 tests/utils.py     | 2 +-
 uffd/__init__.py   | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/test_user.py b/tests/test_user.py
index 5b57936c..efc98383 100644
--- a/tests/test_user.py
+++ b/tests/test_user.py
@@ -153,7 +153,7 @@ class TestUserViews(UffdTestCase):
 		self.assertEqual(_user.mail, 'newuser@example.com')
 		self.assertEqual(_user.uid, user.uid)
 		self.assertEqual(_user.loginname, user.loginname)
-		self.assertTrue(ldap.test_user_bind(_user.dn, 'userpassword'))
+		self.assertTrue(ldap.test_user_bind(user.dn, 'userpassword'))
 		self.assertEqual(roles, ['base', 'role1'])
 
 	def test_update_password(self):
diff --git a/tests/utils.py b/tests/utils.py
index abb0445f..1dff72ec 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -15,7 +15,7 @@ def dump(basename, resp):
 		return
 	os.makedirs(root, exist_ok=True)
 	path = os.path.join(root, basename+suffix)
-	with open(path, 'xb') as f:
+	with open(path, 'wb') as f:
 		f.write(resp.data)
 
 def db_flush():
diff --git a/uffd/__init__.py b/uffd/__init__.py
index 53d6965f..3b841095 100644
--- a/uffd/__init__.py
+++ b/uffd/__init__.py
@@ -12,7 +12,7 @@ sys.path.append('deps/ldapalchemy')
 
 # pylint: disable=wrong-import-position
 from uffd.database import db, SQLAlchemyJSON
-from uffd.ldap import ldap
+import uffd.ldap
 from uffd.template_helper import register_template_helper
 from uffd.navbar import setup_navbar
 # pylint: enable=wrong-import-position
@@ -67,7 +67,7 @@ def create_app(test_config=None): # pylint: disable=too-many-locals
 	@app.shell_context_processor
 	def push_request_context(): #pylint: disable=unused-variable
 		app.test_request_context().push() # LDAP ORM requires request context
-		return {'db': db, 'ldap': ldap}
+		return {'db': db, 'ldap': uffd.ldap.ldap}
 
 	@app.route("/")
 	def index(): #pylint: disable=unused-variable
-- 
GitLab