-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Endpoint for updating task name (#11814)
* Endpoint for updating task name * Added the actual endpoint * exception handling and update tests * Format changes * imports ordering
- Loading branch information
Showing
6 changed files
with
197 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
.../tests/Designer.Tests/Controllers/ProcessModelingController/UpdateProcessTaskNameTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Net.Mime; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Xml.Linq; | ||
using Designer.Tests.Controllers.ApiTests; | ||
using Designer.Tests.Utils; | ||
using FluentAssertions; | ||
using Microsoft.AspNetCore.Mvc.Testing; | ||
using Xunit; | ||
|
||
namespace Designer.Tests.Controllers.ProcessModelingController | ||
{ | ||
public class UpdateProcessTaskName : DisagnerEndpointsTestsBase<UpdateProcessTaskName>, IClassFixture<WebApplicationFactory<Program>> | ||
{ | ||
private static string Url(string org, string repository, string taskId, string taskName) => $"/designer/api/{org}/{repository}/process-modelling/tasks/{taskId}/{taskName}"; | ||
|
||
public UpdateProcessTaskName(WebApplicationFactory<Program> factory) : base(factory) | ||
{ | ||
} | ||
|
||
[Theory] | ||
[InlineData("ttd", "app-with-process", "testUser", "Task_1", "NewTaskName")] | ||
public async Task UpdateProcessTaskName_ShouldReturnUpdatedProcess(string org, string app, string developer, string taskId, string taskName) | ||
{ | ||
string targetRepository = TestDataHelper.GenerateTestRepoName(); | ||
await CopyRepositoryForTest(org, app, developer, targetRepository); | ||
|
||
string url = Url(org, targetRepository, taskId, taskName); | ||
|
||
using var response = await HttpClient.PutAsync(url, null); | ||
response.StatusCode.Should().Be(HttpStatusCode.OK); | ||
|
||
string responseContent = await response.Content.ReadAsStringAsync(); | ||
|
||
responseContent.Should().NotBeNullOrEmpty(); | ||
responseContent.Should().Contain(taskName); | ||
} | ||
|
||
[Theory] | ||
[InlineData("ttd", "app-with-process", "testUser", "Does_not_exist", "NewTaskName")] | ||
public async Task InvalidTaskId_ShouldReturnBadRequest(string org, string app, string developer, string taskId, string taskName) | ||
{ | ||
string targetRepository = TestDataHelper.GenerateTestRepoName(); | ||
await CopyRepositoryForTest(org, app, developer, targetRepository); | ||
|
||
string url = Url(org, targetRepository, taskId, taskName); | ||
|
||
using var response = await HttpClient.PutAsync(url, null); | ||
response.StatusCode.Should().Be(HttpStatusCode.BadRequest); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...ests/_TestData/Repositories/testUser/ttd/app-with-process/App/config/process/process.bpmn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:altinn="http://altinn.no" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Altinn_SingleDataTask_Process_Definition" targetNamespace="http://bpmn.io/schema/bpmn"> | ||
<bpmn:process id="SingleDataTask" isExecutable="false"> | ||
<bpmn:startEvent id="StartEvent_1"> | ||
<bpmn:outgoing>SequenceFlow_1n56yn5</bpmn:outgoing> | ||
</bpmn:startEvent> | ||
<bpmn:endEvent id="EndEvent_1"> | ||
<bpmn:incoming>Flow_1htunjv</bpmn:incoming> | ||
</bpmn:endEvent> | ||
<bpmn:sequenceFlow id="SequenceFlow_1n56yn5" sourceRef="StartEvent_1" targetRef="Task_1" /> | ||
<bpmn:task id="Task_1" name="Utfylling"> | ||
<bpmn:extensionElements> | ||
<altinn:taskExtension> | ||
<altinn:taskType>data</altinn:taskType> | ||
</altinn:taskExtension> | ||
</bpmn:extensionElements> | ||
<bpmn:incoming>SequenceFlow_1n56yn5</bpmn:incoming> | ||
<bpmn:outgoing>Flow_1htunjv</bpmn:outgoing> | ||
</bpmn:task> | ||
<bpmn:sequenceFlow id="Flow_1htunjv" sourceRef="Task_1" targetRef="EndEvent_1" /> | ||
</bpmn:process> | ||
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | ||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="SingleDataTask"> | ||
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> | ||
<dc:Bounds x="156" y="81" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="Task_1_di" bpmnElement="Task_1"> | ||
<dc:Bounds x="260" y="59" width="100" height="80" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNShape id="EndEvent_1_di" bpmnElement="EndEvent_1"> | ||
<dc:Bounds x="422" y="81" width="36" height="36" /> | ||
</bpmndi:BPMNShape> | ||
<bpmndi:BPMNEdge id="SequenceFlow_1n56yn5_di" bpmnElement="SequenceFlow_1n56yn5"> | ||
<di:waypoint x="192" y="99" /> | ||
<di:waypoint x="260" y="99" /> | ||
</bpmndi:BPMNEdge> | ||
<bpmndi:BPMNEdge id="Flow_1htunjv_di" bpmnElement="Flow_1htunjv"> | ||
<di:waypoint x="360" y="99" /> | ||
<di:waypoint x="422" y="99" /> | ||
</bpmndi:BPMNEdge> | ||
</bpmndi:BPMNPlane> | ||
</bpmndi:BPMNDiagram> | ||
</bpmn:definitions> |