def test_ACL_append (): acl = _acls.acl ([("Everyone", "R", "Allow")]) acl.append (("Administrators", "F", "Deny")) assert list (acl) == [ _aces.dace (("Administrators", "F", "Deny")), _aces.dace (("Everyone", "R", "Allow")) ]
def test_ACL_append(self): acl = _acls.acl([("Everyone", "R", "Allow")]) acl.append(("Administrators", "F", "Deny")) assert list(acl) == [ _aces.dace(("Administrators", "F", "Deny")), _aces.dace(("Everyone", "R", "Allow")) ]
def test_ACL_iterated (): # # This includes a test for sorting, putting deny records first # acl = _acls.acl ([("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")]) assert list (acl) == [ _aces.dace (("Administrators", "F", "Deny")), _aces.dace (("Everyone", "R", "Allow")) ]
def test_ACL_iterated(self): # # This includes a test for sorting, putting deny records first # acl = _acls.acl([("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")]) assert list(acl) == [ _aces.dace(("Administrators", "F", "Deny")), _aces.dace(("Everyone", "R", "Allow")) ]
def test_ACL_delitem(self): acl = _acls.acl([("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")]) del acl[0] assert list(acl) == [ _aces.dace(("Administrators", "F", "Deny")), ]
def test_dace_tuple2(self): dace2 = _aces.dace((accounts.principal("Everyone"), "F", "ALLOW")) assert dace2.type == win32security.ACCESS_ALLOWED_ACE_TYPE assert dace2.is_allowed == True assert dace2._trustee.pyobject() == everyone assert dace2._access_mask == ntsecuritycon.GENERIC_ALL assert dace2.flags == _aces.ACE.FLAGS assert dace2.object_type is core.UNSET assert dace2.inherited_object_type is core.UNSET
def test_acl_iterable(self): daces0 = [("Everyone", "R", "Allow"), ("Administrators", "F", "Allow")] def iteraces(): for dace in daces0: yield dace assert list(_acls.dacl(iteraces())) == list( _aces.dace(dace) for dace in daces0)
def test_dace_tuple1 (self): dace1 = _aces.dace ((accounts.principal (everyone), ntsecuritycon.GENERIC_ALL, win32security.ACCESS_ALLOWED_ACE_TYPE)) assert dace1.type == win32security.ACCESS_ALLOWED_ACE_TYPE assert dace1.is_allowed == True assert dace1._trustee.pyobject () == everyone assert dace1._access_mask == ntsecuritycon.GENERIC_ALL assert dace1.flags == _aces.ACE.FLAGS assert dace1.object_type is core.UNSET assert dace1.inherited_object_type is core.UNSET
def test_dace_tuple2 (): dace2 = _aces.dace ((accounts.principal ("Everyone"), "F", "ALLOW")) assert dace2.type == win32security.ACCESS_ALLOWED_ACE_TYPE assert dace2.is_allowed == True assert dace2._trustee.pyobject () == everyone assert dace2._access_mask == ntsecuritycon.GENERIC_ALL assert dace2.flags == _aces.ACE.FLAGS assert dace2.object_type is core.UNSET assert dace2.inherited_object_type is core.UNSET
def test_dace_tuple1(): dace1 = _aces.dace( (accounts.principal(everyone), ntsecuritycon.GENERIC_ALL, win32security.ACCESS_ALLOWED_ACE_TYPE)) assert dace1.type == win32security.ACCESS_ALLOWED_ACE_TYPE assert dace1.is_allowed == True assert dace1._trustee.pyobject() == everyone assert dace1._access_mask == ntsecuritycon.GENERIC_ALL assert dace1.flags == _aces.ACE.FLAGS assert dace1.object_type is core.UNSET assert dace1.inherited_object_type is core.UNSET
def test_dace_invalid (self): with self.assertRaises (_aces.x_ace): _aces.dace (None)
def test_ACL_delitem (): acl = _acls.acl ([("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")]) del acl[0] assert list (acl) == [ _aces.dace (("Administrators", "F", "Deny")), ]
def test_dace_ne_trustee(self): assert \ _aces.dace((accounts.principal(everyone), ntsecuritycon.GENERIC_ALL, win32security.ACCESS_ALLOWED_ACE_TYPE)) != \ _aces.dace((accounts.principal("Administrators"), "F", "ALLOW"))
def test_dace_ne_access(self): assert \ _aces.dace((accounts.principal(everyone), ntsecuritycon.GENERIC_ALL, win32security.ACCESS_ALLOWED_ACE_TYPE)) != \ _aces.dace((accounts.principal("Everyone"), "R", "ALLOW"))
def test_dace_as_string (): _aces.dace (("Everyone", "R", "ALLOW")).as_string ()
def test_dace_invalid(self): with self.assertRaises(_aces.x_ace): _aces.dace(None)
def test_dace_as_string(self): _aces.dace(("Everyone", "R", "ALLOW")).as_string()
def test_dace_invalid (): _aces.dace (None)
def test_dace_lt (): assert _aces.dace (("Everyone", "R", "DENY")) < _aces.dace (("Everyone", "R", "ALLOW"))
def test_dace_lt(self): assert _aces.dace(("Everyone", "R", "DENY")) < _aces.dace( ("Everyone", "R", "ALLOW"))
def test_dace_ne_type (): assert \ _aces.dace ((accounts.principal (everyone), ntsecuritycon.GENERIC_ALL, win32security.ACCESS_ALLOWED_ACE_TYPE)) != \ _aces.dace ((accounts.principal ("Everyone"), "R", "DENY"))
def test_dace_invalid(): _aces.dace(None)
def test_dace_eq (): assert \ _aces.dace ((accounts.principal (everyone), ntsecuritycon.GENERIC_ALL, win32security.ACCESS_ALLOWED_ACE_TYPE)) == \ _aces.dace ((accounts.principal ("Everyone"), "F", "ALLOW"))
def test_acl_iterable (): daces0 = [("Everyone", "R", "Allow"), ("Administrators", "F", "Allow")] def iteraces (): for dace in daces0: yield dace assert list (_acls.dacl (iteraces ())) == list (_aces.dace (dace) for dace in daces0)
def test_dace_dace(self): dace = _aces.DACE(everyone, "F", "ALLOW") assert _aces.dace(dace) is dace
def test_dace_ne_trustee (): assert \ _aces.dace ((accounts.principal (everyone), ntsecuritycon.GENERIC_ALL, win32security.ACCESS_ALLOWED_ACE_TYPE)) != \ _aces.dace ((accounts.principal ("Administrators"), "F", "ALLOW"))
def test_dace_dace (): dace = _aces.DACE (everyone, "F", "ALLOW") assert _aces.dace (dace) is dace