Skip to content

Fix schema validation and complete pytest API tasks#219

Open
dhathrik18 wants to merge 1 commit intoautomationExamples:mainfrom
dhathrik18:fix-pytest-api-tests
Open

Fix schema validation and complete pytest API tasks#219
dhathrik18 wants to merge 1 commit intoautomationExamples:mainfrom
dhathrik18:fix-pytest-api-tests

Conversation

@dhathrik18
Copy link
Copy Markdown

Summary

Completed the required pytest API automation tasks and fixed failing tests.

Changes Made

  1. Fixed schema validation issue in schemas.py

    • Updated "name" field type from integer to string to match actual API response
  2. Completed test_find_by_status_200

    • Added parameterization for all statuses (available, sold, pending)
    • Validated response status code
    • Validated each pet's status
    • Added schema validation for each response object
  3. Completed test_get_by_id_404

    • Added parameterized invalid test cases
    • Validated 404 responses

Test Results

All tests passing:

7 passed in 12.56s

Observations / Bugs Found

  1. GET /pets/0 returns 200 instead of 404 (edge-case inconsistency)
  2. Schema definition issue for "name" field (expected integer but API returns string)

Notes

  • Verified using local Flask server and Swagger UI
  • Attached Screenshot of the terminal Output
Screenshot 2026-03-22 195219

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant