Test for create_new_.

This commit is contained in:
sfigato 2019-07-06 21:26:21 +02:00
parent f05fe8a0d5
commit 3454c194b1
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F

View File

@ -18,6 +18,7 @@ from phi.async_ldap.model import (
Robots,
Congregations,
Service,
create_new_,
User,
Group,
)
@ -375,6 +376,23 @@ def test_Congregations_children(client_fixture_multi):
assert GROUP_LIST == c.children
@pytest.mark.asyncio
async def test_create_new_(client_fixture):
self = Namespace()
self.dn = f"uid=test,ou=Tests,{BASE_DN}"
self.client = client_fixture
self.object_class = ["a", "b", "c"]
ENTRY_DICT = {"attr1": "val1", "attr2": "val2", "attr3": "val3", "attr4": "val4"}
res = await create_new_(self, **ENTRY_DICT)
assert res is not None
assert client_fixture.called_with_args["add"]["args"][0] == res
assert res["objectClass"] == self.object_class
for k, v in ENTRY_DICT.items():
assert v == res[k][0]
def test_User(client_fixture):
c = User("conte_mascetti", client_fixture)