コード例 #1
0
 def test_list_values(self):
     '''
     Test - List the values under a subkey.
     '''
     subkey = r'Software\Microsoft\Windows NT\CurrentVersion'
     test_list = win_mod_reg.list_values('HKEY_LOCAL_MACHINE', subkey)
     test = len(test_list) > 5  # There should be a lot more than 5 items
     self.assertTrue(test)
コード例 #2
0
ファイル: reg_win_test.py プロジェクト: bryson/salt
 def test_list_values(self):
     '''
     Test - List the values under a subkey.
     '''
     subkey = r'Software\Microsoft\Windows NT\CurrentVersion'
     test_list = win_mod_reg.list_values('HKEY_LOCAL_MACHINE', subkey)
     test = len(test_list) > 5  # There should be a lot more than 5 items
     self.assertTrue(test)
コード例 #3
0
 def test_list_values_fail(self):
     '''
     Test - List the values under a subkey which does not exist.
     '''
     subkey = 'ThisIsJunkItDoesNotExistIhope'
     test_list = win_mod_reg.list_values('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
ファイル: reg_win_test.py プロジェクト: bryson/salt
 def test_list_values_fail(self):
     '''
     Test - List the values under a subkey which does not exist.
     '''
     subkey = 'ThisIsJunkItDoesNotExistIhope'
     test_list = win_mod_reg.list_values('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_values_existing(self):
     """
     Test the list_values function using a well known registry key
     """
     values = reg.list_values(
         hive="HKLM", key="SOFTWARE\\Microsoft\\Windows\\CurrentVersion")
     keys = []
     for value in values:
         keys.append(value["vname"])
     self.assertIn("ProgramFilesDir", keys)
コード例 #6
0
 def test_list_values_existing(self):
     '''
     Test the list_values function using a well known registry key
     '''
     values = reg.list_values(
         hive='HKLM', key='SOFTWARE\\Microsoft\\Windows\\CurrentVersion')
     keys = []
     for value in values:
         keys.append(value['vname'])
     self.assertIn('ProgramFilesDir', keys)
コード例 #7
0
ファイル: test_reg.py プロジェクト: mcalmer/salt
 def test_list_values_non_existing(self):
     """
     Test the list_values function using a non existing registry key
     """
     expected = (False, "Cannot find key: HKLM\\{}".format(FAKE_KEY))
     self.assertEqual(reg.list_values(hive="HKLM", key=FAKE_KEY), expected)
コード例 #8
0
 def test_list_values_non_existing(self):
     '''
     Test the list_values function using a non existing registry key
     '''
     expected = (False, 'Cannot find key: HKLM\\{0}'.format(FAKE_KEY))
     self.assertEqual(reg.list_values(hive='HKLM', key=FAKE_KEY), expected)