Skip to content

Commit ec289c4

Browse files
authored
add api tests for payload delete (#788)
Signed-off-by: Sam Rooke <[email protected]>
1 parent 534e8e9 commit ec289c4

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

tests/IntegrationTests/WorkflowExecutor.IntegrationTests/Features/PayloadApi.feature

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,32 @@ Scenario Outline: Get payload by Id returns 400
124124
When I send a GET request
125125
Then I will get a 400 response
126126
And I will receive the error message Failed to validate id, not a valid guid
127+
128+
@DeletePayloadById
129+
Scenario Outline: Delete payload by Id returns 400 with invalid payload ID
130+
Given I have an endpoint /payload/invalid-payload-id
131+
When I send a DELETE request
132+
Then I will get a 400 response
133+
And I will receive the error message Failed to validate id, not a valid guid
134+
135+
@DeletePayloadById
136+
Scenario Outline: Delete payload by ID returns 404 when no payload exists
137+
Given I have an endpoint /payload/c5c3635b-81dd-44a9-8c3b-71adec7d47c6
138+
When I send a DELETE request
139+
Then I will get a 404 response
140+
And I will receive the error message Payload with ID: c5c3635b-81dd-44a9-8c3b-71adec7d47c6 not found
141+
142+
@DeletePayloadById
143+
Scenario Outline: Delete payload by ID returns 400 when PayloadDeleted is already InProgress
144+
Given I have an endpoint /payload/c5c3635b-81dd-44a9-8c3b-71adec7d47c6
145+
And I have a payload saved in mongo Payload_PayloadDeleted_InProgress
146+
When I send a DELETE request
147+
Then I will get a 400 response
148+
And I will receive the error message Deletion of files for payload ID: c5c3635b-81dd-44a9-8c3b-71adec7d47c6 already in progress
149+
150+
@DeletePayloadById
151+
Scenario Outline: Delete payload by ID returns 202
152+
Given I have an endpoint /payload/d5c3633b-41de-44a9-8c3a-71adec3d47c1
153+
And I have a payload saved in mongo Payload_PayloadDeleted_No
154+
When I send a DELETE request
155+
Then I will get a 202 response

tests/IntegrationTests/WorkflowExecutor.IntegrationTests/TestData/PayloadTestData.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,54 @@ public static class PayloadsTestData
305305
}
306306
}
307307
},
308+
new PayloadTestData()
309+
{
310+
Name = "Payload_PayloadDeleted_InProgress",
311+
Payload = new Payload()
312+
{
313+
Id = Guid.NewGuid().ToString(),
314+
Timestamp = DateTime.UtcNow,
315+
Bucket = "bucket_1",
316+
CalledAeTitle = "MIG",
317+
CallingAeTitle = "Basic_AE",
318+
CorrelationId = Guid.NewGuid().ToString(),
319+
PayloadId = "c5c3635b-81dd-44a9-8c3b-71adec7d47c6",
320+
Workflows = new List<string> { Guid.NewGuid().ToString() },
321+
FileCount = 50,
322+
PayloadDeleted = PayloadDeleted.InProgress,
323+
PatientDetails = new PatientDetails()
324+
{
325+
PatientDob = new DateTime(1996, 02, 05, 0, 0, 0, kind: DateTimeKind.Utc),
326+
PatientId = Guid.NewGuid().ToString(),
327+
PatientName = "Mike Mcgee",
328+
PatientSex = "male"
329+
}
330+
}
331+
},
332+
new PayloadTestData()
333+
{
334+
Name = "Payload_PayloadDeleted_No",
335+
Payload = new Payload()
336+
{
337+
Id = Guid.NewGuid().ToString(),
338+
Timestamp = DateTime.UtcNow,
339+
Bucket = "bucket_1",
340+
CalledAeTitle = "MIG",
341+
CallingAeTitle = "Basic_AE",
342+
CorrelationId = Guid.NewGuid().ToString(),
343+
PayloadId = "d5c3633b-41de-44a9-8c3a-71adec3d47c1",
344+
Workflows = new List<string> { Guid.NewGuid().ToString() },
345+
FileCount = 50,
346+
PayloadDeleted = PayloadDeleted.No,
347+
PatientDetails = new PatientDetails()
348+
{
349+
PatientDob = new DateTime(1996, 02, 05, 0, 0, 0, kind: DateTimeKind.Utc),
350+
PatientId = Guid.NewGuid().ToString(),
351+
PatientName = "Mike Mcgee",
352+
PatientSex = "male"
353+
}
354+
}
355+
}
308356
};
309357
}
310358
}

0 commit comments

Comments
 (0)