Beispiel #1
0
    def test_get_object_create_update_delete(self):
        obj = api.create_object(self.ctxt, self.model, {'name': 'foo'})

        new_obj = api.get_object(self.ctxt, self.model, id=obj.id)
        self.assertEqual(obj, new_obj)

        obj = new_obj
        api.update_object(self.ctxt, self.model, {'name': 'bar'}, id=obj.id)

        new_obj = api.get_object(self.ctxt, self.model, id=obj.id)
        self.assertEqual(obj, new_obj)

        obj = new_obj
        api.delete_object(self.ctxt, self.model, id=obj.id)

        new_obj = api.get_object(self.ctxt, self.model, id=obj.id)
        self.assertIsNone(new_obj)

        # delete_object raises an exception on missing object
        self.assertRaises(
            n_exc.ObjectNotFound,
            api.delete_object, self.ctxt, self.model, id=obj.id)

        # but delete_objects does not not
        api.delete_objects(self.ctxt, self.model, id=obj.id)
Beispiel #2
0
    def test_get_object_create_update_delete(self):
        obj = api.create_object(self.ctxt, self.model, {'name': 'foo'})

        new_obj = api.get_object(self.ctxt, self.model, id=obj.id)
        self.assertEqual(obj, new_obj)

        obj = new_obj
        api.update_object(self.ctxt, self.model, {'name': 'bar'}, id=obj.id)

        new_obj = api.get_object(self.ctxt, self.model, id=obj.id)
        self.assertEqual(obj, new_obj)

        obj = new_obj
        api.delete_object(self.ctxt, self.model, id=obj.id)

        new_obj = api.get_object(self.ctxt, self.model, id=obj.id)
        self.assertIsNone(new_obj)

        # delete_object raises an exception on missing object
        self.assertRaises(n_exc.ObjectNotFound,
                          api.delete_object,
                          self.ctxt,
                          self.model,
                          id=obj.id)

        # but delete_objects does not not
        api.delete_objects(self.ctxt, self.model, id=obj.id)
Beispiel #3
0
 def delete(self):
     obj_db_api.delete_object(self._context, self.db_model,
                              **self._get_composite_keys())
Beispiel #4
0
 def delete(self):
     obj_db_api.delete_object(self.obj_context, self.db_model,
                              **self.modify_fields_to_db(
                                  self._get_composite_keys()))
     self._captured_db_model = None
Beispiel #5
0
 def delete(self):
     obj_db_api.delete_object(self.obj_context, self.db_model,
                              **self.modify_fields_to_db(
                                  self._get_composite_keys()))
     self._captured_db_model = None
Beispiel #6
0
 def delete(self):
     obj_db_api.delete_object(self._context, self.db_model,
                              **self._get_composite_keys())