Implement POST task

This commit is contained in:
Drew 2025-08-24 10:41:56 -07:00
parent 20ee812393
commit 2b2fc974a2
10 changed files with 141 additions and 47 deletions

View file

@ -5,10 +5,7 @@ POST {{host}}/api/tasks
Content-Type: application/json
{
"title": "Test task",
"description": "A test task for the API",
"priority": "medium",
"due_date": "2024-12-31",
"status": "todo"
"description": "A test task for the API"
}
HTTP 201
@ -17,8 +14,6 @@ task_id: jsonpath "$.id"
[Asserts]
jsonpath "$.title" == "Test task"
jsonpath "$.description" == "A test task for the API"
jsonpath "$.priority" == "medium"
jsonpath "$.due_date" == "2024-12-31"
jsonpath "$.status" == "todo"
jsonpath "$.id" exists
jsonpath "$.created_at" exists
@ -36,10 +31,8 @@ HTTP 201
minimal_task_id: jsonpath "$.id"
[Asserts]
jsonpath "$.title" == "Minimal task"
jsonpath "$.priority" == "medium"
jsonpath "$.status" == "todo"
jsonpath "$.description" == null
jsonpath "$.due_date" == null
# Test: Create task with invalid data (missing title)
POST {{host}}/api/tasks
@ -48,7 +41,7 @@ Content-Type: application/json
"description": "Task without title"
}
HTTP 400
HTTP 422
[Asserts]
jsonpath "$.error" exists
@ -57,22 +50,10 @@ POST {{host}}/api/tasks
Content-Type: application/json
{
"title": "Invalid priority task",
"priority": "invalid"
"priority": "This field does not exist."
}
HTTP 400
[Asserts]
jsonpath "$.error" exists
# Test: Create task with invalid status
POST {{host}}/api/tasks
Content-Type: application/json
{
"title": "Invalid status task",
"status": "invalid"
}
HTTP 400
HTTP 422
[Asserts]
jsonpath "$.error" exists