예제 #1
0
 def test_set_value_reg_qword(self):
     '''
     Test the set_value function on a unicode value
     '''
     try:
         self.assertTrue(
             win_reg.set_value(hive='HKLM',
                               key=FAKE_KEY,
                               vname='qword_value',
                               vdata=123,
                               vtype='REG_QWORD'))
         expected = {
             'hive': 'HKLM',
             'key': FAKE_KEY,
             'success': True,
             'vdata': 123,
             'vname': 'qword_value',
             'vtype': 'REG_QWORD'
         }
         self.assertEqual(
             win_reg.read_value(hive='HKLM',
                                key=FAKE_KEY,
                                vname='qword_value'), expected)
     finally:
         win_reg.delete_key_recursive(hive='HKLM', key=FAKE_KEY)
예제 #2
0
 def test_set_value_unicode_key(self):
     '''
     Test the set_value function on a unicode key
     '''
     try:
         self.assertTrue(
             win_reg.set_value(hive='HKLM',
                               key='{0}\\{1}'.format(FAKE_KEY, UNICODE_KEY),
                               vname='fake_name',
                               vdata='fake_value'))
         expected = {
             'hive': 'HKLM',
             'key': '{0}\\{1}'.format(FAKE_KEY, UNICODE_KEY),
             'success': True,
             'vdata': 'fake_value',
             'vname': 'fake_name',
             'vtype': 'REG_SZ'
         }
         self.assertEqual(
             win_reg.read_value(hive='HKLM',
                                key='{0}\\{1}'.format(
                                    FAKE_KEY, UNICODE_KEY),
                                vname='fake_name'), expected)
     finally:
         win_reg.delete_key_recursive(hive='HKLM', key=FAKE_KEY)
예제 #3
0
 def test_delete_value_unicode(self):
     '''
     Test the delete_value function on a unicode value
     '''
     try:
         self.assertTrue(
             win_reg.set_value(hive='HKLM',
                               key=FAKE_KEY,
                               vname='fake_unicode',
                               vdata=UNICODE_VALUE))
         self.assertTrue(
             win_reg.delete_value(hive='HKLM',
                                  key=FAKE_KEY,
                                  vname='fake_unicode'))
     finally:
         win_reg.delete_key_recursive(hive='HKLM', key=FAKE_KEY)
예제 #4
0
 def test_delete_value(self):
     '''
     Test the delete_value function
     '''
     try:
         self.assertTrue(
             win_reg.set_value(hive='HKLM',
                               key=FAKE_KEY,
                               vname='fake_name',
                               vdata='fake_data'))
         self.assertTrue(
             win_reg.delete_value(hive='HKLM',
                                  key=FAKE_KEY,
                                  vname='fake_name'))
     finally:
         win_reg.delete_key_recursive(hive='HKLM', key=FAKE_KEY)
예제 #5
0
 def test_delete_key_unicode(self):
     '''
     Test the delete_value function on value within a unicode key
     '''
     try:
         self.assertTrue(
             win_reg.set_value(hive='HKLM',
                               key='{0}\\{1}'.format(FAKE_KEY, UNICODE_KEY),
                               vname='fake_name',
                               vdata='fake_value'))
         expected = {
             'Deleted': ['HKLM\\{0}\\{1}\\'.format(FAKE_KEY, UNICODE_KEY)],
             'Failed': []
         }
         self.assertEqual(
             win_reg.delete_key_recursive(
                 hive='HKLM',
                 key='{0}\\{1}\\'.format(FAKE_KEY, UNICODE_KEY),
             ), expected)
     finally:
         win_reg.delete_key_recursive(hive='HKLM', key=FAKE_KEY)
예제 #6
0
 def test_set_value_default(self):
     '''
     Test the set_value function on the default value
     '''
     try:
         self.assertTrue(
             win_reg.set_value(hive='HKLM',
                               key=FAKE_KEY,
                               vdata='fake_default_data'))
         expected = {
             'hive': 'HKLM',
             'key': FAKE_KEY,
             'success': True,
             'vdata': 'fake_default_data',
             'vname': '(Default)',
             'vtype': 'REG_SZ'
         }
         self.assertEqual(win_reg.read_value(
             hive='HKLM',
             key=FAKE_KEY,
         ), expected)
     finally:
         win_reg.delete_key_recursive(hive='HKLM', key=FAKE_KEY)
예제 #7
0
 def setUp(self):
     self.assertTrue(
         win_reg.set_value(hive="HKLM",
                           key=FAKE_KEY,
                           vname="fake_name",
                           vdata="fake_data"))