Failing add user test

This commit is contained in:
User Identifier 2020-10-03 18:42:18 +02:00
parent dbf6ca966f
commit 93328aa2cf

View File

@ -16,3 +16,44 @@ def test_get_users_by_ou(ldap_client):
users = get_users_by_ou(ldap_client, 'Hackers')
assert 'conte_mascetti' in [u['uid'] for u in users]
def test_add_user(ldap_client):
client = ldap_client
cn = 'Rosa'
sn = 'Rossi'
mail = 'foo@autistici.org'
uid = 'rosa_rossi'
dn = 'uid={},ou=Hackers,{}'.format(
uid, client.base_dn
)
response_id = client.connection.add(
dn,
attributes={
'objectClass': [
'inetOrgPerson',
'organizationalPerson',
'person', 'top'
],
'cn': cn,
'sn': sn,
'mail': mail
}
)
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['uid'] == uid
assert entry['mail'] == email
assert False