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