Mercurial > kallithea
changeset 8374:4a4e4a498518 stable
tests: fix test_auth_ldap dependency on test order to avoid failure on uniqueness constraint
It would perhaps be even better to have each test clean up ... but let's only
aim for only avoiding collision on leaked test data.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 30 Apr 2020 13:46:56 +0200 |
parents | 9bf701b246ba |
children | 33427561b389 |
files | kallithea/tests/other/test_auth_ldap.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/tests/other/test_auth_ldap.py Fri Apr 24 12:14:28 2020 +0200 +++ b/kallithea/tests/other/test_auth_ldap.py Thu Apr 30 13:46:56 2020 +0200 @@ -24,7 +24,7 @@ def authenticate_ldap(self, username, password): return 'spam dn', dict(test_ldap_firstname=['spam ldap first name'], test_ldap_lastname=['spam ldap last name'], - test_ldap_email=['spam ldap email']) + test_ldap_email=['%s ldap email' % username]) def test_update_user_attributes_from_ldap(monkeypatch, create_test_user, @@ -56,13 +56,13 @@ assert user_data is not None assert user_data.get('firstname') == 'spam ldap first name' assert user_data.get('lastname') == 'spam ldap last name' - assert user_data.get('email') == 'spam ldap email' + assert user_data.get('email') == '%s ldap email' % username # Verify that authentication overwrote user attributes with the ones # retrieved from LDAP. assert user.firstname == 'spam ldap first name' assert user.lastname == 'spam ldap last name' - assert user.email == 'spam ldap email' + assert user.email == '%s ldap email' % username def test_init_user_attributes_from_ldap(monkeypatch, arrange_ldap_auth): @@ -85,7 +85,7 @@ assert user_data is not None assert user_data.get('firstname') == 'spam ldap first name' assert user_data.get('lastname') == 'spam ldap last name' - assert user_data.get('email') == 'spam ldap email' + assert user_data.get('email') == '%s ldap email' % username # Verify that authentication created new user with attributes # retrieved from LDAP. @@ -93,7 +93,7 @@ assert new_user is not None assert new_user.firstname == 'spam ldap first name' assert new_user.lastname == 'spam ldap last name' - assert new_user.email == 'spam ldap email' + assert new_user.email == '%s ldap email' % username class _AuthLdapNoEmailMock():