Skip to content

Commit

Permalink
fix not found workflow response (#435)
Browse files Browse the repository at this point in the history
* fix not found workflow response

Signed-off-by: Jack Schofield <jack.schofield@answerdigital.com>

* fix test

Signed-off-by: Jack Schofield <jack.schofield@answerdigital.com>

* Changed error assertion to look for basic layout of errors as well as content

Signed-off-by: RemakingEden <joss.sparkes@gmail.com>

Signed-off-by: Jack Schofield <jack.schofield@answerdigital.com>
Signed-off-by: RemakingEden <joss.sparkes@gmail.com>
Co-authored-by: RemakingEden <joss.sparkes@gmail.com>
Signed-off-by: Jack Schofield <jack.schofield@answerdigital.com>
  • Loading branch information
jackschofield23 and RemakingEden committed Sep 22, 2022
1 parent 1458197 commit 034ea3a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public async Task<IActionResult> UpdateAsync([FromBody] Workflow workflow, [From
{
_logger.LogDebug($"{nameof(UpdateAsync)} - Failed to find workflow with Id: {id}");

return NotFound($"Failed to find workflow with Id: {id}");
return Problem($"Failed to find workflow with Id: {id}", $"/workflows/{id}", NotFound);
}

return StatusCode(StatusCodes.Status201Created, new CreateWorkflowResponse(workflowId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ public void GivenIHaveTaskRequestBody(string name)

[Then(@"I will recieve the error message (.*)")]
public void ThenIWillRecieveTheCorrectErrorMessage(string message)
{
{
ApiHelper.Response.Content.ReadAsStringAsync().Result.Should().ContainAll("type", "title", "status", "traceId");
ApiHelper.Response.Content.ReadAsStringAsync().Result.Should().Contain(message);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public async Task UpdateAsync_WorkflowsDoesNotExist_ReturnsNotFound()

var result = await WorkflowsController.UpdateAsync(newWorkflow, workflowRevision.WorkflowId);

var objectResult = Assert.IsType<NotFoundObjectResult>(result);
var objectResult = Assert.IsType<ObjectResult>(result);

Assert.Equal(404, objectResult.StatusCode);
}
Expand Down

0 comments on commit 034ea3a

Please sign in to comment.