示例#1
0
 def test_list_keys(self):
     '''
     Test - Read list the keys under a subkey
     '''
     subkey = 'Software\\Microsoft\\Windows NT\\CurrentVersion'
     test_list = win_mod_reg.list_keys('HKEY_LOCAL_MACHINE', subkey)
     test = len(test_list) > 5  # Their should be a lot more than 5 items
     self.assertTrue(test)
示例#2
0
 def test_list_keys(self):
     '''
     Test - Read list the keys under a subkey
     '''
     subkey = 'Software\\Microsoft\\Windows NT\\CurrentVersion'
     test_list = win_mod_reg.list_keys('HKEY_LOCAL_MACHINE', subkey)
     test = len(test_list) > 5  # Their should be a lot more than 5 items
     self.assertTrue(test)
示例#3
0
 def test_list_keys_fail(self):
     '''
     Test - Read list the keys under a subkey which does not exist.
     '''
     subkey = 'ThisIsJunkItDoesNotExistIhope'
     test_list = win_mod_reg.list_keys('HKEY_LOCAL_MACHINE', subkey)
     # returns a tuple with first item false, and second item a reason
     test = isinstance(test_list, tuple) and (not test_list[0])
     self.assertTrue(test)
示例#4
0
 def test_list_keys_fail(self):
     '''
     Test - Read list the keys under a subkey which does not exist.
     '''
     subkey = 'ThisIsJunkItDoesNotExistIhope'
     test_list = win_mod_reg.list_keys('HKEY_LOCAL_MACHINE', subkey)
     # returns a tuple with first item false, and second item a reason
     test = isinstance(test_list, tuple) and (not test_list[0])
     self.assertTrue(test)
示例#5
0
文件: test_reg.py 项目: mcalmer/salt
 def test_list_keys_non_existing(self):
     """
     Test the list_keys function using a non existing registry key
     """
     expected = (False, "Cannot find key: HKLM\\{}".format(FAKE_KEY))
     self.assertEqual(reg.list_keys(hive="HKLM", key=FAKE_KEY), expected)
示例#6
0
文件: test_reg.py 项目: mcalmer/salt
 def test_list_keys_existing(self):
     """
     Test the list_keys function using a well known registry key
     """
     self.assertIn("Microsoft", reg.list_keys(hive="HKLM", key="SOFTWARE"))
示例#7
0
 def test_list_keys_non_existing(self):
     '''
     Test the list_keys function using a non existing registry key
     '''
     expected = (False, 'Cannot find key: HKLM\\{0}'.format(FAKE_KEY))
     self.assertEqual(reg.list_keys(hive='HKLM', key=FAKE_KEY), expected)
示例#8
0
 def test_list_keys_existing(self):
     '''
     Test the list_keys function using a well known registry key
     '''
     self.assertIn('Microsoft', reg.list_keys(hive='HKLM', key='SOFTWARE'))