aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/__init__.py0
-rw-r--r--test/test_configuration_working.py17
-rw-r--r--test/util.py13
3 files changed, 30 insertions, 0 deletions
diff --git a/test/__init__.py b/test/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/__init__.py
diff --git a/test/test_configuration_working.py b/test/test_configuration_working.py
new file mode 100644
index 0000000..9bbe2c7
--- /dev/null
+++ b/test/test_configuration_working.py
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+
+import logging
+
+import radicale_auth_ldap
+from test.configuration import TEST_CONFIGURATION, VALID_USER, VALID_PASS
+from test.util import ConfigMock
+
+
+def main():
+ configuration = ConfigMock(TEST_CONFIGURATION)
+ logger = logging.getLogger(__name__)
+ auth = radicale_auth_ldap.Auth(configuration, logger)
+ assert auth.is_authenticated(VALID_USER, VALID_PASS)
+
+if __name__ == '__main__':
+ main()
diff --git a/test/util.py b/test/util.py
new file mode 100644
index 0000000..97566b0
--- /dev/null
+++ b/test/util.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+from collections.abc import Mapping
+
+
+class ConfigMock:
+ def __init__(self, configuration):
+ assert isinstance(configuration, Mapping)
+ assert all(isinstance(x, Mapping) for x in configuration.values())
+ self.configuration = configuration
+
+ def get(self, a, b):
+ return self.configuration[a][b]
bgstack15