fix: failing tests and resolve test suite
Description
This merge request fixes multiple inconsistencies between test cases and the actual application schemas, validators, and fixtures.
A total of 33 failing tests across 7 test files were resolved by aligning test expectations with the current implementation.
Key Fixes:
-
Schema Alignment
- Updated incorrect field names (
place→current_place, addedusername) - Removed references to non-existent fields (
corrections_made,correction_type) - Fixed invalid enum/type values (e.g.,
"Picture"→"image")
- Updated incorrect field names (
-
Validation Fixes
- Corrected test data to meet validator requirements (e.g., descriptions ≥10 words)
- Updated whitespace and newline constraints to match actual limits
- Fixed language codes (
"hindi"→"hi")
-
Return Type Fixes
- Adjusted assertions to match actual return types (string vs date object)
-
OCR Segment Fixes
- Corrected
reading_orderlogic (must start at 0 and be sequential) - Updated regex expectations for error messages
- Corrected
-
Fixtures & Imports
- Removed invalid imports (
CorrectionEntry) - Added missing fixtures (
admin_token_headers,user_token_headers,test_category)
- Removed invalid imports (
-
Test Data Refactor
- Centralized and corrected test data to ensure consistency across tests
Root Cause Summary:
- Schema field mismatches
- Validator threshold mismatches
- Incorrect assumptions in test assertions
- Invalid test data
- Missing fixtures/imports
Result:
-
✅ 33 failures → 0 failures -
✅ All 435 tests passing or correctly skipped -
✅ Improved test reliability and maintainability
Checklist
-
The bug has been reproduced and confirmed -
A clear and concise fix has been implemented -
New/updated tests prevent regressions -
All existing tests are passing
Related Issue(s)
Closes #108 (closed)
Edited by srilatha bandari
