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)
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"))
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'))
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)
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)
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)
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)
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)
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)