Esempio n. 1
0
 def create(self):
     if self.obj_attr_is_set('id'):
         raise exception.ObjectActionError(action='create',
                                           reason=_('already created'))
     updates = self.karbor_obj_get_changes()
     db_operation_log = db.operation_log_create(self._context, updates)
     self._from_db_object(self._context, self, db_operation_log)
Esempio n. 2
0
 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'],
                             {'status': 'finished'})
     operation_log = db.operation_log_get(self.ctxt, operation_log['id'])
     self.assertEqual('finished', operation_log['status'])
Esempio n. 3
0
 def create(self):
     if self.obj_attr_is_set('id'):
         raise exception.ObjectActionError(action='create',
                                           reason=_('already created'))
     updates = self.karbor_obj_get_changes()
     db_operation_log = db.operation_log_create(self._context, updates)
     self._from_db_object(self._context, self, db_operation_log)
Esempio n. 4
0
 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'])
Esempio n. 5
0
 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'])
Esempio n. 6
0
 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']))
Esempio n. 7
0
 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.status)
Esempio n. 8
0
 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'])
Esempio n. 9
0
 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']))
Esempio n. 10
0
 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)