Example #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")
Example #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"))
  ]
Example #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"))
     ]
Example #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")),
     ]
Example #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")
Example #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)
Example #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"))
  ]
Example #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"))
     ]
Example #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
Example #10
0
def test_acl_ACL ():
  acl0 = _acls.ACL ()
  acl = _acls.acl (acl0)
  assert acl is acl0
Example #11
0
 def test_acl_ACL(self):
     acl0 = _acls.ACL()
     acl = _acls.acl(acl0)
     assert acl is acl0
Example #12
0
 def test_acl_None(self):
     acl = _acls.acl(None)
     assert isinstance(acl, _acls.ACL) and acl.pyobject() is None
Example #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
Example #14
0
 def test_ACL_nonzero(self):
     assert not _acls.acl(None)
     assert not _acls.acl([])
     assert _acls.acl([("Everyone", "R", "Allow")])
Example #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)
Example #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")
Example #17
0
def test_ACL_nonzero ():
  assert not _acls.acl (None)
  assert not _acls.acl ([])
  assert _acls.acl ([("Everyone", "R", "Allow")])
Example #18
0
def test_ACL_len ():
  aces = [("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")]
  acl = _acls.acl (aces)
  assert len (acl) == len (aces)
Example #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")), 
  ]
Example #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")
Example #21
0
 def test_ACL_len(self):
     aces = [("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")]
     acl = _acls.acl(aces)
     assert len(acl) == len(aces)
Example #22
0
def test_acl_None ():
  acl = _acls.acl (None)
  assert isinstance (acl, _acls.ACL) and acl.pyobject () is None