Skip to content

unit-test-Backend-API-Schemas

  • Clear Description: This MR adds unit tests for Pydantic schema validation to ensure invalid data is rejected at the schema layer before reaching business logic.

What’s Covered

  • User, Patient, Doctor, Consultation, Medicine, and Medical Camp schemas
  • Field constraints, regex checks, enums, and type validation
  • Custom validator behavior (where applicable)
  • Positive and negative test cases for all models

Testing Approach

  • Separate test files per schema module
  • Assert valid payloads pass without errors
  • Assert invalid payloads raise pydantic.ValidationError

This improves data integrity and strengthens the overall reliability of the API.

  • Checklist: A checklist of completed tasks, such as:
    • Code follows project API guidelines (if applicable).
    • Tests are included and passing.
    • Documentation is updated (if applicable).
    • Code adheres to project coding standards.
  • Related Issue(s): Link to any relevant issues using Closes #22 .
Edited by Suma Pullaiahgari

Merge request reports

Loading