Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "integer"
},
"name": {
"type": "integer"
"type": "string"
},
"type": {
"type": "string",
Expand All @@ -18,3 +18,16 @@
},
}
}

order = {
"type": "object",
"required": ["id", "pet_id"],
"properties": {
"id": {
"type": "string"
},
"pet_id": {
"type": "integer"
},
}
}
14 changes: 12 additions & 2 deletions test_pet.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_pet_schema():
3) Validate the 'status' property in the response is equal to the expected status
4) Validate the schema for each object in the response
'''
@pytest.mark.parametrize("status", [("available")])
@pytest.mark.parametrize("status", [("available", "sold", "pending")])
def test_find_by_status_200(status):
test_endpoint = "/pets/findByStatus"
params = {
Expand All @@ -36,11 +36,21 @@ def test_find_by_status_200(status):
response = api_helpers.get_api_data(test_endpoint, params)
# TODO...

assert response.status_code == 200

for pet in response.json():
assert pet["status"] in ["available", "sold", "pending"]
validate(instance=pet, schema=schemas.pet)

'''
TODO: Finish this test by...
1) Testing and validating the appropriate 404 response for /pets/{pet_id}
2) Parameterizing the test for any edge cases
'''
def test_get_by_id_404():
# TODO...
pass
test_endpoint = "/pets/-1"

response = api_helpers.get_api_data(test_endpoint)

assert response.status_code == 404
15 changes: 14 additions & 1 deletion test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,17 @@
4) Validate the response message "Order and pet status updated successfully"
'''
def test_patch_order_by_id():
pass

post_endpoint = f"/store/order/"

post_response = api_helpers.post_api_data(endpoint=post_endpoint, data={
"pet_id": 0
})

patch_endpoint = "/store/order/0"
patch_response = api_helpers.patch_api_data(endpoint=patch_endpoint, data={
"status": "available",
"id": 0
})

assert patch_response.message == "Order and pet status updated successfully"