Failing add user test
This commit is contained in:
parent
dbf6ca966f
commit
93328aa2cf
|
@ -16,3 +16,44 @@ def test_get_users_by_ou(ldap_client):
|
||||||
users = get_users_by_ou(ldap_client, 'Hackers')
|
users = get_users_by_ou(ldap_client, 'Hackers')
|
||||||
|
|
||||||
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):
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user