Tests for name property.

refactor
blallo 2019-07-01 22:48:04 +02:00
parent f558492975
commit fe3450b886
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
1 changed files with 27 additions and 0 deletions

View File

@ -384,6 +384,15 @@ def test_User(client_fixture):
assert repr(c) == f"<User({c.name}) {c.dn}>"
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"<Service({c.name}) {c.dn}>"
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"<Group({c.name}) {c.dn}>"
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)