def test_remove_value_not_found(self, w, reg): reg.return_value.RemoveKeyValue.side_effect = \ registry.registry.RegistryError('Test', errno=2) registry.remove_value(self.name) w.assert_called_with( r'Failed to delete non-existant registry key: ' r'%s:\%s\%s', 'HKLM', registry.constants.REG_ROOT, self.name)
def test_remove_value(self, reg): registry.remove_value(self.name) reg.assert_called_with('HKLM') reg.return_value.RemoveKeyValue.assert_has_calls([ mock.call(key_path=registry.constants.REG_ROOT, key_name=self.name, use_64bit=registry.constants.USE_REG_64), ])
def Run(self): use_64bit = True if len(self._args) > 3: use_64bit = self._args[3] try: registry.remove_value(self._args[2], self._args[0], self._args[1], use_64bit=use_64bit) except registry.Error as e: raise ActionError(str(e)) except IndexError: raise ActionError( 'Unable to access all required arguments. [%s]' % str(self._args))
def test_remove_value_silent(self, d, unused_reg): registry.remove_value(self.name, log=False) self.assertFalse(d.called)