Skip to content

Release v0.4.4: Add pytest suite with fake repositories and SQL contract verification

Pre-release
Pre-release

Choose a tag to compare

@devsmish devsmish released this 16 Sep 21:07
· 29 commits to main since this release
fda6671

🧪 Testing & Quality Assurance

Automated Pytest Framework: Introduced pytest.ini and requirements-dev.txt to establish an automated testing workflow replacing ad-hoc terminal verification scripts.

SQL-Faithful Fake Repositories: Created reusable test fixtures in tests/conftest.py that enforce database-level semantics including deleted_at IS NULL filtering and stock >= quantity availability checks.

Service Layer Unit Tests: Implemented complete test suites for AuthService, PurchaseService, AdminService, and CatalogService, including explicit verification that user purchase history remains fully rendered post book soft-deletion.

Financial Logic Verification: Added test_money.py validating parse_money() two-decimal precision, ROUND_HALF_UP rounding rules, and invalid string handling.

🛡️ SQL Contract Assertions & Security

Mocked Connection Query Asserts: Added unit tests for BookRepository, UserRepository, and PurchaseRepository on mocked pymysql connections to assert exact SQL syntax (guarding against accidental omission of soft-delete filters).

Authentic Bcrypt Execution: Configured test_user_repository.py to run against real bcrypt.hashpw and bcrypt.checkpw logic to guarantee real-world password security compliance.

Full Changelog: v0.4.3...v0.4.4