示例#1
0
 def test_get_sid_string_name(self):
     """
     Validate getting a pysid object from a SID string
     """
     sid_obj = win_dacl.get_sid("Administrators")
     self.assertTrue(isinstance(sid_obj, pywintypes.SIDType))
     self.assertEqual(win_dacl.get_sid_string(sid_obj), "S-1-5-32-544")
示例#2
0
 def test_get_sid_string_none(self):
     """
     Validate getting a pysid object from None (NULL SID)
     """
     sid_obj = win_dacl.get_sid(None)
     self.assertTrue(isinstance(sid_obj, pywintypes.SIDType))
     self.assertEqual(win_dacl.get_sid_string(sid_obj), "S-1-0-0")
示例#3
0
 def test_get_sid_string_name(self):
     '''
     Validate getting a pysid object from a SID string
     '''
     sid_obj = win_dacl.get_sid('Administrators')
     self.assertTrue(isinstance(sid_obj, pywintypes.SIDType))
     self.assertEqual(win_dacl.get_sid_string(sid_obj), 'S-1-5-32-544')
示例#4
0
 def test_get_name_using_sid_object(self):
     """
     Test get_name passing a SID Object. Should return the string name
     """
     # SID Object
     sid_obj = win_dacl.get_sid("Administrators")
     self.assertTrue(isinstance(sid_obj, pywintypes.SIDType))
     self.assertEqual(win_dacl.get_name(sid_obj), "Administrators")
示例#5
0
 def test_get_sid_sid_string(self):
     '''
     Validate getting a pysid object from a SID string
     '''
     sid_obj = win_dacl.get_sid('S-1-5-32-544')
     self.assertTrue(isinstance(sid_obj, pywintypes.SIDType))
     self.assertEqual(
         win32security.LookupAccountSid(None, sid_obj)[0], 'Administrators')
示例#6
0
 def test_get_sid_string(self):
     """
     Validate getting a pysid object from a name
     """
     sid_obj = win_dacl.get_sid("Administrators")
     self.assertTrue(isinstance(sid_obj, pywintypes.SIDType))
     self.assertEqual(
         win32security.LookupAccountSid(None, sid_obj)[0], "Administrators")
示例#7
0
 def test_get_name(self):
     '''
     Get the name
     '''
     # Case
     self.assertEqual(win_dacl.get_name('adMiniStrAtorS'), 'Administrators')
     # SID String
     self.assertEqual(win_dacl.get_name('S-1-5-32-544'), 'Administrators')
     # SID Object
     sid_obj = win_dacl.get_sid('Administrators')
     self.assertTrue(isinstance(sid_obj, pywintypes.SIDType))
     self.assertEqual(win_dacl.get_name(sid_obj), 'Administrators')
示例#8
0
 def test_get_name(self):
     """
     Get the name
     """
     # Case
     self.assertEqual(win_dacl.get_name("adMiniStrAtorS"), "Administrators")
     # SID String
     self.assertEqual(win_dacl.get_name("S-1-5-32-544"), "Administrators")
     # SID Object
     sid_obj = win_dacl.get_sid("Administrators")
     self.assertTrue(isinstance(sid_obj, pywintypes.SIDType))
     self.assertEqual(win_dacl.get_name(sid_obj), "Administrators")