Add hurl test for task deletion.
This commit is contained in:
parent
026a8be707
commit
0745e8381c
1 changed files with 92 additions and 0 deletions
92
backend/tests/api/delete_tasks.hurl
Normal file
92
backend/tests/api/delete_tasks.hurl
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
# Task Delete API Tests
|
||||
|
||||
# Setup: Create a task to delete
|
||||
POST {{host}}/api/tasks
|
||||
Content-Type: application/json
|
||||
{
|
||||
"title": "Task to Delete",
|
||||
"description": "This task will be deleted"
|
||||
}
|
||||
|
||||
HTTP 201
|
||||
[Captures]
|
||||
delete_task_id: jsonpath "$.id"
|
||||
|
||||
# Test: Delete task successfully
|
||||
DELETE {{host}}/api/tasks/{{delete_task_id}}
|
||||
|
||||
HTTP 204
|
||||
|
||||
# Test: Verify task is deleted (should return 404)
|
||||
GET {{host}}/api/tasks/{{delete_task_id}}
|
||||
|
||||
HTTP 404
|
||||
[Asserts]
|
||||
jsonpath "$.error" exists
|
||||
|
||||
# Setup: Create another task for additional tests
|
||||
POST {{host}}/api/tasks
|
||||
Content-Type: application/json
|
||||
{
|
||||
"title": "Another Task to Delete"
|
||||
}
|
||||
|
||||
HTTP 201
|
||||
[Captures]
|
||||
another_task_id: jsonpath "$.id"
|
||||
|
||||
# Test: Verify task exists before deletion
|
||||
GET {{host}}/api/tasks/{{another_task_id}}
|
||||
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
jsonpath "$.title" == "Another Task to Delete"
|
||||
|
||||
# Test: Delete the task
|
||||
DELETE {{host}}/api/tasks/{{another_task_id}}
|
||||
|
||||
HTTP 204
|
||||
|
||||
# Test: Confirm task no longer exists
|
||||
GET {{host}}/api/tasks/{{another_task_id}}
|
||||
|
||||
HTTP 404
|
||||
[Asserts]
|
||||
jsonpath "$.error" exists
|
||||
|
||||
# Test: Delete non-existent task
|
||||
DELETE {{host}}/api/tasks/00000000-0000-0000-0000-000000000000
|
||||
|
||||
HTTP 404
|
||||
[Asserts]
|
||||
jsonpath "$.error" exists
|
||||
|
||||
# Test: Delete with invalid UUID format
|
||||
DELETE {{host}}/api/tasks/invalid-uuid-format
|
||||
|
||||
HTTP 400
|
||||
[Asserts]
|
||||
jsonpath "$.error" exists
|
||||
|
||||
# Test: Multiple deletions of same task (idempotency test)
|
||||
POST {{host}}/api/tasks
|
||||
Content-Type: application/json
|
||||
{
|
||||
"title": "Task for Idempotency Test"
|
||||
}
|
||||
|
||||
HTTP 201
|
||||
[Captures]
|
||||
idempotent_task_id: jsonpath "$.id"
|
||||
|
||||
# First deletion should succeed
|
||||
DELETE {{host}}/api/tasks/{{idempotent_task_id}}
|
||||
|
||||
HTTP 204
|
||||
|
||||
# Second deletion should return 404 (task already gone)
|
||||
DELETE {{host}}/api/tasks/{{idempotent_task_id}}
|
||||
|
||||
HTTP 404
|
||||
[Asserts]
|
||||
jsonpath "$.error" exists
|
||||
Loading…
Add table
Add a link
Reference in a new issue