From 8941407f273a284df6841df4046f781e2f184edd Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 8 Jul 2022 10:27:35 +0200 Subject: [PATCH] test migration of ldap --- seed/dovecot/tests/test_imap.py | 2 +- seed/openldap/tests/test_openldap.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/seed/dovecot/tests/test_imap.py b/seed/dovecot/tests/test_imap.py index ba4a9b7e..6063348f 100644 --- a/seed/dovecot/tests/test_imap.py +++ b/seed/dovecot/tests/test_imap.py @@ -11,7 +11,7 @@ conf_file = f'{environ["MACHINE_TEST_DIR"]}/imap.yml' with open(conf_file) as yaml: data = load(yaml, Loader=SafeLoader) parameters = (('user', data['username'], data['password']), - ('family', data['username_family'], data['password_family']), + ('family', data['username_family'], data['password_family'] + "2"), ) diff --git a/seed/openldap/tests/test_openldap.py b/seed/openldap/tests/test_openldap.py index 62a89770..b5284cf6 100644 --- a/seed/openldap/tests/test_openldap.py +++ b/seed/openldap/tests/test_openldap.py @@ -23,7 +23,7 @@ def test_ldap_admin(): l.simple_bind_s(data['admin_dn'], data['admin_password']) assert l.search_s(data['base_account_dn'], SCOPE_SUBTREE,'(objectClass=inetOrgPerson)',['cn']) - + def test_ldap_accounts(): 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']) -def test_ldap_user_family(): +def test_ldap_migration(): conf_file = f'{environ["MACHINE_TEST_DIR"]}/openldap.yml' with open(conf_file) as yaml: data = load(yaml, Loader=SafeLoader) set_option(OPT_X_TLS_REQUIRE_CERT, OPT_X_TLS_NEVER) 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():