コード例 #1
0
 def test_create(self, mock_action_event_start):
     mock_action_event_start.return_value = fake_event
     event = instance_action.InstanceActionEvent(self.context)
     expected_updates = event.obj_get_changes()
     expected_updates['instance_uuid'] = fake_action['instance_uuid']
     expected_updates['request_id'] = fake_action['request_id']
     event.create(fake_action['instance_uuid'], fake_action['request_id'])
     mock_action_event_start.assert_called_once_with(
         self.context, expected_updates)
     self.compare_obj(event, fake_event)
コード例 #2
0
 def test_create_id_in_updates_error(self):
     event = instance_action.InstanceActionEvent(self.context, id=1)
     ex = self.assertRaises(exception.ObjectActionError, event.create,
                            fake_action['instance_uuid'],
                            fake_action['request_id'])
     self.assertIn('already created', six.text_type(ex))