1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
import pytest
from bonsai.active_directory import UserAccountControl
def test_init():
""" Test creating UserAccountControl. """
with pytest.raises(TypeError):
_ = UserAccountControl("123")
uac = UserAccountControl(209)
assert uac is not None
def test_value():
""" Test value property. """
uac = UserAccountControl(209)
assert uac.value == 209
def test_properties():
""" Test properties property. """
uac = UserAccountControl(514)
assert uac.properties["accountdisable"]
assert uac.properties["normal_account"]
assert all(
val == False
for key, val in uac.properties.items()
if key not in ("accountdisable", "normal_account")
)
uac = UserAccountControl(67584)
assert uac.properties["dont_expire_password"]
assert uac.properties["interdomain_trust_account"]
assert all(
val == False
for key, val in uac.properties.items()
if key not in ("dont_expire_password", "interdomain_trust_account")
)
|