def create(self): if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason=_('already created')) updates = self.smaug_obj_get_changes() db_operation_log = db.operation_log_create(self._context, updates) self._from_db_object(self._context, self, db_operation_log)
def test_operation_log_update(self): operation_log = db.operation_log_create(self.ctxt, self.fake_operation_log) db.operation_log_update(self.ctxt, operation_log['id'], {'state': 'finished'}) operation_log = db.operation_log_get(self.ctxt, operation_log['id']) self.assertEqual('finished', operation_log['state'])
def test_operation_log_destroy(self): operation_log = db.operation_log_create(self.ctxt, self.fake_operation_log) db.operation_log_destroy(self.ctxt, operation_log['id']) self.assertRaises(exception.OperationLogNotFound, db.operation_log_get, self.ctxt, operation_log['id'])
def test_operation_log_get(self): operation_log = db.operation_log_create(self.ctxt, self.fake_operation_log) self._assertEqualObjects(operation_log, db.operation_log_get( self.ctxt, operation_log['id']))
def test_operation_log_create(self): operation_log = db.operation_log_create(self.ctxt, self.fake_operation_log) self.assertTrue(uuidutils.is_uuid_like(operation_log['id'])) self.assertEqual('failed', operation_log.state)
def test_operation_log_get(self): operation_log = db.operation_log_create(self.ctxt, self.fake_operation_log) self._assertEqualObjects( operation_log, db.operation_log_get(self.ctxt, operation_log['id']))