Пример #1
0
def test_ACL_getitem ():
  acl = _acls.acl ([("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")])
  #
  # Note that the list is *stored* in the order entered; it
  # is only returned (via pyobject) in sorted order.
  #
  assert acl[0] == ("Everyone", "R", "Allow")
Пример #2
0
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"))
  ]
Пример #3
0
 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"))
     ]
Пример #4
0
 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")),
     ]
Пример #5
0
 def test_ACL_getitem(self):
     acl = _acls.acl([("Everyone", "R", "Allow"),
                      ("Administrators", "F", "Deny")])
     #
     # Note that the list is *stored* in the order entered; it
     # is only returned (via pyobject) in sorted order.
     #
     assert acl[0] == ("Everyone", "R", "Allow")
Пример #6
0
 def test_acl_PyACL(self):
     dacl = win32security.ACL()
     dacl.AddAccessAllowedAceEx(win32security.ACL_REVISION_DS, 0,
                                ntsecuritycon.FILE_READ_DATA, everyone)
     acl = _acls.acl(dacl).pyobject()
     assert dacl.GetAceCount() == 1
     assert dacl.GetAce(0) == ((win32security.ACCESS_ALLOWED_ACE_TYPE, 0),
                               ntsecuritycon.FILE_READ_DATA, everyone)
Пример #7
0
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"))
  ]
Пример #8
0
 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"))
     ]
Пример #9
0
def test_ACL_contains ():
  aces = [("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")]
  acl = _acls.acl (aces)
  for ace in aces:
    assert ace in acl
  assert ("Everyone", "F", "Deny") not in acl
Пример #10
0
def test_acl_ACL ():
  acl0 = _acls.ACL ()
  acl = _acls.acl (acl0)
  assert acl is acl0
Пример #11
0
 def test_acl_ACL(self):
     acl0 = _acls.ACL()
     acl = _acls.acl(acl0)
     assert acl is acl0
Пример #12
0
 def test_acl_None(self):
     acl = _acls.acl(None)
     assert isinstance(acl, _acls.ACL) and acl.pyobject() is None
Пример #13
0
 def test_ACL_contains(self):
     aces = [("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")]
     acl = _acls.acl(aces)
     for ace in aces:
         assert ace in acl
     assert ("Everyone", "F", "Deny") not in acl
Пример #14
0
 def test_ACL_nonzero(self):
     assert not _acls.acl(None)
     assert not _acls.acl([])
     assert _acls.acl([("Everyone", "R", "Allow")])
Пример #15
0
def test_acl_PyACL ():
  dacl = win32security.ACL ()
  dacl.AddAccessAllowedAceEx (win32security.ACL_REVISION_DS, 0, ntsecuritycon.FILE_READ_DATA, everyone)
  acl = _acls.acl (dacl).pyobject ()
  assert dacl.GetAceCount () == 1
  assert dacl.GetAce (0) == ((win32security.ACCESS_ALLOWED_ACE_TYPE, 0), ntsecuritycon.FILE_READ_DATA, everyone)
Пример #16
0
 def test_ACL_setitem(self):
     acl = _acls.acl([("Everyone", "R", "Allow"),
                      ("Administrators", "F", "Deny")])
     acl[0] = ((me, "R", "Allow"))
     assert acl[0] == (me, "R", "Allow")
Пример #17
0
def test_ACL_nonzero ():
  assert not _acls.acl (None)
  assert not _acls.acl ([])
  assert _acls.acl ([("Everyone", "R", "Allow")])
Пример #18
0
def test_ACL_len ():
  aces = [("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")]
  acl = _acls.acl (aces)
  assert len (acl) == len (aces)
Пример #19
0
def test_ACL_delitem ():
  acl = _acls.acl ([("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")])
  del acl[0]
  assert list (acl) == [
    _aces.dace (("Administrators", "F", "Deny")), 
  ]
Пример #20
0
def test_ACL_setitem ():
  acl = _acls.acl ([("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")])
  acl[0] = ((me, "R", "Allow"))
  assert acl[0] == (me, "R", "Allow")
Пример #21
0
 def test_ACL_len(self):
     aces = [("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")]
     acl = _acls.acl(aces)
     assert len(acl) == len(aces)
Пример #22
0
def test_acl_None ():
  acl = _acls.acl (None)
  assert isinstance (acl, _acls.ACL) and acl.pyobject () is None