Exemplo n.º 1
0
    def test_resource_get(self):
        res = create_resource(self.ctx, self.stack)
        ret_res = db_api.resource_get(self.ctx, res.id)
        self.assertIsNotNone(ret_res)

        self.assertRaises(exception.NotFound, db_api.resource_get,
                          self.ctx, UUID2)
Exemplo n.º 2
0
    def test_resource_get(self):
        res = create_resource(self.ctx, self.stack)
        ret_res = db_api.resource_get(self.ctx, res.id)
        self.assertIsNotNone(ret_res)

        self.assertRaises(exception.NotFound, db_api.resource_get, self.ctx,
                          UUID2)
Exemplo n.º 3
0
 def get_obj(cls, context, resource_id, refresh=False, fields=None):
     if fields is None or 'data' in fields:
         refresh_data = refresh
     else:
         refresh_data = False
     resource_db = db_api.resource_get(context, resource_id,
                                       refresh=refresh,
                                       refresh_data=refresh_data)
     return cls._from_db_object(cls(context), context, resource_db,
                                only_fields=fields)
Exemplo n.º 4
0
 def get_obj(cls, context, resource_id, refresh=False, fields=None):
     if fields is None or 'data' in fields:
         refresh_data = refresh
     else:
         refresh_data = False
     resource_db = db_api.resource_get(context, resource_id,
                                       refresh=refresh,
                                       refresh_data=refresh_data)
     return cls._from_db_object(cls(context), context, resource_db,
                                only_fields=fields)
Exemplo n.º 5
0
 def test_resource_create(self):
     res = create_resource(self.ctx, self.stack)
     ret_res = db_api.resource_get(self.ctx, res.id)
     self.assertIsNotNone(ret_res)
     self.assertEqual('test_resource_name', ret_res.name)
     self.assertEqual(UUID1, ret_res.nova_instance)
     self.assertEqual('create', ret_res.action)
     self.assertEqual('complete', ret_res.status)
     self.assertEqual('create_complete', ret_res.status_reason)
     self.assertEqual('{"foo": "123"}', dumps(ret_res.rsrc_metadata))
     self.assertEqual(self.stack.id, ret_res.stack_id)
Exemplo n.º 6
0
 def test_resource_create(self):
     res = create_resource(self.ctx, self.stack)
     ret_res = db_api.resource_get(self.ctx, res.id)
     self.assertIsNotNone(ret_res)
     self.assertEqual('test_resource_name', ret_res.name)
     self.assertEqual(UUID1, ret_res.nova_instance)
     self.assertEqual('create', ret_res.action)
     self.assertEqual('complete', ret_res.status)
     self.assertEqual('create_complete', ret_res.status_reason)
     self.assertEqual('{"foo": "123"}', dumps(ret_res.rsrc_metadata))
     self.assertEqual(self.stack.id, ret_res.stack_id)
Exemplo n.º 7
0
 def refresh(self):
     resource_db = db_api.resource_get(self._context, self.id, refresh=True)
     return self.__class__._from_db_object(self, self._context, resource_db)
Exemplo n.º 8
0
 def get_obj(cls, context, resource_id, refresh=False):
     resource_db = db_api.resource_get(context, resource_id, refresh=refresh)
     return cls._from_db_object(cls(context), context, resource_db)
Exemplo n.º 9
0
 def refresh(self):
     resource_db = db_api.resource_get(self._context, self.id, refresh=True)
     return self.__class__._from_db_object(self, self._context, resource_db)
Exemplo n.º 10
0
 def get_obj(cls, context, resource_id, refresh=False):
     resource_db = db_api.resource_get(context,
                                       resource_id,
                                       refresh=refresh)
     return cls._from_db_object(cls(context), context, resource_db)