mirror of
https://github.com/jdupouy/radicale3-auth-ldap.git
synced 2024-10-27 19:14:00 +00:00
add simple integration test
This commit is contained in:
parent
0f094e7859
commit
063f3a42d2
0
test/__init__.py
Normal file
0
test/__init__.py
Normal file
17
test/test_configuration_working.py
Normal file
17
test/test_configuration_working.py
Normal file
@ -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()
|
13
test/util.py
Normal file
13
test/util.py
Normal file
@ -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]
|
Loading…
Reference in New Issue
Block a user