File: test_ad_useraccountcontrol.py

package info (click to toggle)
python-bonsai 1.5.3%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,136 kB
  • sloc: python: 6,816; ansic: 5,549; makefile: 170; sh: 90
file content (37 lines) | stat: -rw-r--r-- 1,025 bytes parent folder | download | duplicates (2)
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")
    )