def test_destroy_resource_class(self, mock_delete, mock_write, mock_read): mock_read.side_effect = etcd.EtcdKeyNotFound resource_class = utils.create_test_resource_class(context=self.context) mock_read.side_effect = lambda *args: FakeEtcdResult(resource_class. as_dict()) dbapi.destroy_resource_class(self.context, resource_class.uuid) mock_delete.assert_called_once_with('/resource_classes/%s' % resource_class.uuid)
def destroy(self, context=None): """Delete the ResourceClass from the DB. :param context: Security context. NOTE: This should only be used internally by the indirection_api. Unfortunately, RPC requires context as the first argument, even though we don't use it. A context should be set when instantiating the object, e.g.: ResourceClass(context) """ dbapi.destroy_resource_class(context, self.uuid) self.obj_reset_changes()
def test_destroy_resource_class(self): resource = utils.create_test_resource_class(context=self.context) dbapi.destroy_resource_class(self.context, resource.id) self.assertRaises(exception.ResourceClassNotFound, dbapi.get_resource_class, self.context, resource.id)
def test_destroy_resource_class(self): resource = utils.create_test_resource_class(context=self.context) dbapi.destroy_resource_class(self.context, resource.id) self.assertRaises(exception.ResourceClassNotFound, dbapi.get_resource_class, self.context, resource.id)