Exemplo n.º 1
0
 def test_delete_value_non_existing(self):
     '''
     Test the delete_value function on non existing value
     '''
     self.assertEqual(
         win_reg.delete_value(hive='HKLM', key=FAKE_KEY, vname='fake_name'),
         None)
Exemplo n.º 2
0
 def test_delete_value_non_existing(self):
     """
     Test the delete_value function on non existing value
     """
     mock_error = MagicMock(
         side_effect=win32api.error(2, "RegOpenKeyEx", "Unknown error"))
     with patch("salt.utils.win_reg.win32api.RegOpenKeyEx", mock_error):
         self.assertIsNone(
             win_reg.delete_value(hive="HKLM",
                                  key=FAKE_KEY,
                                  vname="fake_name"))
Exemplo n.º 3
0
 def test_delete_value_non_existing(self):
     '''
     Test the delete_value function on non existing value
     '''
     mock_error = MagicMock(
         side_effect=win32api.error(2, 'RegOpenKeyEx', 'Unknown error'))
     with patch('salt.utils.win_reg.win32api.RegOpenKeyEx', mock_error):
         self.assertIsNone(
             win_reg.delete_value(hive='HKLM',
                                  key=FAKE_KEY,
                                  vname='fake_name'))
Exemplo n.º 4
0
 def test_delete_value_unicode_vname(self):
     """
     Test the delete_value function on a unicode vname
     """
     try:
         self.assertTrue(
             win_reg.set_value(
                 hive="HKLM", key=FAKE_KEY, vname=UNICODE_KEY, vdata="junk data"
             )
         )
         self.assertTrue(
             win_reg.delete_value(hive="HKLM", key=FAKE_KEY, vname=UNICODE_KEY)
         )
     finally:
         win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)
Exemplo n.º 5
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)
Exemplo n.º 6
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)
Exemplo n.º 7
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)
Exemplo n.º 8
0
 def test_delete_value_unicode_key(self):
     '''
     Test the delete_value function on a unicode key
     '''
     try:
         self.assertTrue(
             win_reg.set_value(hive='HKLM',
                               key='\\'.join([FAKE_KEY, UNICODE_KEY]),
                               vname='fake_name',
                               vdata='junk data'))
         self.assertTrue(
             win_reg.delete_value(hive='HKLM',
                                  key='\\'.join([FAKE_KEY, UNICODE_KEY]),
                                  vname='fake_name'))
     finally:
         win_reg.delete_key_recursive(hive='HKLM', key=FAKE_KEY)
Exemplo n.º 9
0
 def test_delete_value_unicode_key(self):
     """
     Test the delete_value function on a unicode key
     """
     try:
         self.assertTrue(
             win_reg.set_value(
                 hive="HKLM",
                 key="\\".join([FAKE_KEY, UNICODE_KEY]),
                 vname="fake_name",
                 vdata="junk data",
             ))
         self.assertTrue(
             win_reg.delete_value(
                 hive="HKLM",
                 key="\\".join([FAKE_KEY, UNICODE_KEY]),
                 vname="fake_name",
             ))
     finally:
         win_reg.delete_key_recursive(hive="HKLM", key=FAKE_KEY)