test migration of ldap

This commit is contained in:
Emmanuel Garette 2022-07-08 10:27:35 +02:00
parent e068298d3c
commit 8941407f27
2 changed files with 7 additions and 4 deletions

View file

@ -11,7 +11,7 @@ conf_file = f'{environ["MACHINE_TEST_DIR"]}/imap.yml'
with open(conf_file) as yaml: with open(conf_file) as yaml:
data = load(yaml, Loader=SafeLoader) data = load(yaml, Loader=SafeLoader)
parameters = (('user', data['username'], data['password']), parameters = (('user', data['username'], data['password']),
('family', data['username_family'], data['password_family']), ('family', data['username_family'], data['password_family'] + "2"),
) )

View file

@ -23,7 +23,7 @@ def test_ldap_admin():
l.simple_bind_s(data['admin_dn'], data['admin_password']) l.simple_bind_s(data['admin_dn'], data['admin_password'])
assert l.search_s(data['base_account_dn'], SCOPE_SUBTREE,'(objectClass=inetOrgPerson)',['cn']) assert l.search_s(data['base_account_dn'], SCOPE_SUBTREE,'(objectClass=inetOrgPerson)',['cn'])
def test_ldap_accounts(): def test_ldap_accounts():
conf_file = f'{environ["MACHINE_TEST_DIR"]}/openldap.yml' conf_file = f'{environ["MACHINE_TEST_DIR"]}/openldap.yml'
@ -70,13 +70,16 @@ def test_ldap_user():
l.simple_bind_s(data['user_dn'], data['user_password']) l.simple_bind_s(data['user_dn'], data['user_password'])
def test_ldap_user_family(): def test_ldap_migration():
conf_file = f'{environ["MACHINE_TEST_DIR"]}/openldap.yml' conf_file = f'{environ["MACHINE_TEST_DIR"]}/openldap.yml'
with open(conf_file) as yaml: with open(conf_file) as yaml:
data = load(yaml, Loader=SafeLoader) data = load(yaml, Loader=SafeLoader)
set_option(OPT_X_TLS_REQUIRE_CERT, OPT_X_TLS_NEVER) set_option(OPT_X_TLS_REQUIRE_CERT, OPT_X_TLS_NEVER)
l = initialize(f'ldaps://{data["address"]}') l = initialize(f'ldaps://{data["address"]}')
l.simple_bind_s(data['user_family_dn'], data['user_family_password']) if 'FIRST_RUN' in environ:
l.simple_bind_s(data['admin_dn'], data['admin_password'])
l.passwd_s(data['user_family_dn'], data['user_family_password'], data['user_family_password'] + "2")
l.simple_bind_s(data['user_family_dn'], data['user_family_password'] + "2")
def test_ldap_remote_auth(): def test_ldap_remote_auth():