Delete user after adding it

This commit is contained in:
User Identifier 2020-10-04 16:47:33 +02:00
parent 81b81c6a50
commit 0b91ee1f22

View File

@ -18,7 +18,7 @@ def test_get_users_by_ou(ldap_client):
assert 'conte_mascetti' in [u['uid'] for u in users] assert 'conte_mascetti' in [u['uid'] for u in users]
def test_add_user(ldap_client): def test_add_delete_user(ldap_client):
client = ldap_client client = ldap_client
cn = 'Rosa' cn = 'Rosa'
@ -26,9 +26,7 @@ def test_add_user(ldap_client):
mail = 'foo@autistici.org' mail = 'foo@autistici.org'
uid = 'rosa_rossi' uid = 'rosa_rossi'
dn = 'uid={},ou=Hackers,{}'.format( dn = 'uid={},ou=Hackers,{}'.format(uid, client.base_dn)
uid, client.base_dn
)
response_id = client.connection.add( response_id = client.connection.add(
dn, dn,
@ -55,3 +53,16 @@ def test_add_user(ldap_client):
entry = get_user_by_uid(ldap_client, uid) entry = get_user_by_uid(ldap_client, uid)
assert entry['uid'] == uid assert entry['uid'] == uid
assert entry['mail'] == mail assert entry['mail'] == mail
response_id = client.connection.delete(dn)
response, result, request = client.connection.get_response(
response_id, get_request=True
)
print("Request: {}".format(request))
print("Response: {}".format(response))
print("Result: {}".format(result))
entry = get_user_by_uid(ldap_client, uid)
assert entry is None