add simple integration test

This commit is contained in:
Marco Huenseler 2017-08-04 18:54:20 +02:00
parent 0f094e7859
commit 063f3a42d2
3 changed files with 30 additions and 0 deletions

0
test/__init__.py Normal file
View File

View 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
View 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]