예제 #1
0
 def save(self):
     updates = self.karbor_obj_get_changes()
     if updates and self.id:
         self._convert_operation_definition_to_db_format(updates)
         db.scheduled_operation_update(self._context,
                                       self.id,
                                       updates)
         self.obj_reset_changes()
예제 #2
0
    def test_scheduled_operation_update(self):
        operation_ref = self._create_scheduled_operation()
        id = operation_ref['id']
        operation_ref = db.scheduled_operation_update(self.ctxt, id,
                                                      {"name": "abc"})
        self.assertEqual('abc', operation_ref['name'])

        operation_ref = db.scheduled_operation_get(self.ctxt, id)
        self.assertEqual('abc', operation_ref['name'])

        self.assertRaises(exception.ScheduledOperationNotFound,
                          db.scheduled_operation_update, self.ctxt, '100',
                          {"name": "abc"})
예제 #3
0
    def test_scheduled_operation_update(self):
        operation_ref = self._create_scheduled_operation()
        id = operation_ref['id']
        operation_ref = db.scheduled_operation_update(self.ctxt,
                                                      id,
                                                      {"name": "abc"})
        self.assertEqual('abc', operation_ref['name'])

        operation_ref = db.scheduled_operation_get(self.ctxt, id)
        self.assertEqual('abc', operation_ref['name'])

        self.assertRaises(exception.ScheduledOperationNotFound,
                          db.scheduled_operation_update,
                          self.ctxt, '100', {"name": "abc"})