示例#1
0
文件: test_acls.py 项目: hashar/WAPT
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
文件: test_acls.py 项目: hashar/WAPT
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
文件: test_acls.py 项目: hashar/WAPT
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
文件: test_acls.py 项目: hashar/WAPT
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
文件: test_acls.py 项目: hashar/WAPT
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
文件: test_acls.py 项目: hashar/WAPT
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
文件: test_acls.py 项目: hashar/WAPT
def test_ACL_nonzero ():
  assert not _acls.acl (None)
  assert not _acls.acl ([])
  assert _acls.acl ([("Everyone", "R", "Allow")])
示例#18
0
文件: test_acls.py 项目: hashar/WAPT
def test_ACL_len ():
  aces = [("Everyone", "R", "Allow"), ("Administrators", "F", "Deny")]
  acl = _acls.acl (aces)
  assert len (acl) == len (aces)
示例#19
0
文件: test_acls.py 项目: hashar/WAPT
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
文件: test_acls.py 项目: hashar/WAPT
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
文件: test_acls.py 项目: hashar/WAPT
def test_acl_None ():
  acl = _acls.acl (None)
  assert isinstance (acl, _acls.ACL) and acl.pyobject () is None