diff --git a/backend/tests/api/delete_tasks.hurl b/backend/tests/api/delete_tasks.hurl new file mode 100644 index 0000000..cf8cc61 --- /dev/null +++ b/backend/tests/api/delete_tasks.hurl @@ -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 \ No newline at end of file