From fe3450b88659f9da8fc8907a2fef427df7eec7ec Mon Sep 17 00:00:00 2001 From: Blallo Date: Mon, 1 Jul 2019 22:48:04 +0200 Subject: [PATCH] Tests for name property. --- async_tests/test_async_ldap_model.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/async_tests/test_async_ldap_model.py b/async_tests/test_async_ldap_model.py index cca7d5b..440a36e 100644 --- a/async_tests/test_async_ldap_model.py +++ b/async_tests/test_async_ldap_model.py @@ -384,6 +384,15 @@ def test_User(client_fixture): assert repr(c) == f"" +def test_User_unsettable_name(client_fixture): + c = User("conte_mascetti", client_fixture) + + with pytest.raises(RuntimeError) as e: + c.name = "totò" + + assert "Name property is not modifiable." in str(e) + + def test_User_singleton(client_fixture): other_client = MockClient(BASE_DN) c1 = User("conte_mascetti", client_fixture) @@ -406,6 +415,15 @@ def test_Service(client_fixture): assert repr(c) == f"" +def test_Service_unsettable_name(client_fixture): + c = Service("phi", client_fixture) + + with pytest.raises(RuntimeError) as e: + c.name = "theta" + + assert "Name property is not modifiable." in str(e) + + def test_Service_singleton(client_fixture): other_client = MockClient(BASE_DN) c1 = Service("phi", client_fixture) @@ -428,6 +446,15 @@ def test_Group(client_fixture): assert repr(c) == f"" +def test_Group_unsettable_name(client_fixture): + c = Group("amici_miei", client_fixture) + + with pytest.raises(RuntimeError) as e: + c.name = "nemici" + + assert "Name property is not modifiable." in str(e) + + def test_Group_singleton(client_fixture): other_client = MockClient(BASE_DN) c1 = Group("amici_miei", client_fixture)