From 3454c194b1008239dbe3485e4dfbc2bec1d8e6fd Mon Sep 17 00:00:00 2001 From: Blallo Date: Sat, 6 Jul 2019 21:26:21 +0200 Subject: [PATCH] Test for create_new_. --- async_tests/test_async_ldap_model.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/async_tests/test_async_ldap_model.py b/async_tests/test_async_ldap_model.py index 440a36e..8f8b9a2 100644 --- a/async_tests/test_async_ldap_model.py +++ b/async_tests/test_async_ldap_model.py @@ -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)