parent
0f094e7859
commit
063f3a42d2
@ -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()
|
@ -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