Fix update nonexistent task
Closes-bug: #1326284 Change-Id: I0eeaff7fbf44c975d2aac0a4839ad0f5fecd3276
This commit is contained in:
parent
3f1a17fc4f
commit
f11aa22684
|
@ -225,7 +225,6 @@ class AdvancedNegativeTestsWithExecutionCreate(base.TestCaseAdvanced):
|
|||
self.assertRaises(exceptions.NotFound, self.client.get_task,
|
||||
'test123', self.execution['id'], str(uuid.uuid4()))
|
||||
|
||||
@testtools.skip('https://bugs.launchpad.net/mistral/+bug/1326284')
|
||||
@test.attr(type='negative')
|
||||
def test_update_nonexistent_task(self):
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ class TasksController(rest.RestController):
|
|||
"[workbook_name=%s, execution_id=%s, id=%s, task=%s]" %
|
||||
(workbook_name, execution_id, id, task))
|
||||
|
||||
if db_api.task_get(workbook_name, execution_id, id):
|
||||
# TODO(rakhmerov): pass task result once it's implemented
|
||||
engine = pecan.request.context['engine']
|
||||
values = engine.convey_task_result(workbook_name,
|
||||
|
|
|
@ -50,14 +50,23 @@ class TestTasksController(base.FunctionalTest):
|
|||
|
||||
@mock.patch.object(engine.EngineClient, "convey_task_result",
|
||||
mock.MagicMock(return_value=UPDATED_TASK))
|
||||
@mock.patch.object(db_api, "task_get",
|
||||
mock.MagicMock(return_value=TASKS[0]))
|
||||
def test_put(self):
|
||||
resp = self.app.put_json(
|
||||
'/v1/workbooks/my_workbook/executions/123/tasks/1',
|
||||
dict(state='STOPPED'))
|
||||
|
||||
self.assertEqual(resp.status_int, 200)
|
||||
self.assertDictEqual(UPDATED_TASK, resp.json)
|
||||
|
||||
@mock.patch.object(engine.EngineClient, "convey_task_result",
|
||||
mock.MagicMock(return_value=UPDATED_TASK))
|
||||
def test_put_no_task(self):
|
||||
resp = self.app.put_json(
|
||||
'/v1/workbooks/my_workbook/executions/123/tasks/1',
|
||||
dict(state='STOPPED'), expect_errors=True)
|
||||
self.assertEqual(resp.status_int, 404)
|
||||
|
||||
@mock.patch.object(db_api, "tasks_get",
|
||||
mock.MagicMock(return_value=TASKS))
|
||||
def test_get_all(self):
|
||||
|
|
Loading…
Reference in New Issue