Conversation
📝 WalkthroughWalkthroughThis pull request introduces comprehensive Django REST Framework test suites for multiple EMR API viewsets, adding approximately 900 lines of new test coverage across Account, Encounter, Facility, Patient, File Upload, Medication Request Prescription, and Resource Request endpoints. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (3)
care/emr/tests/test_file_upload_api.py (1)
186-214: Consider completing the upload before archiving.Right now the archive path doesn’t exercise the actual blob upload, so this test could start failing if the backend ever enforces file existence on “mark upload completed.” A tiny upload step would make this more future-proof.
care/emr/tests/test_account_api.py (1)
36-48: Makeservice_periodtime-agnostic to avoid test time-bombs.The hard-coded 2025 range is already in the past (current date: 2026-02-16), so any validation that expects a current/forward period will make this test flaky. Consider generating dates relative to
timezone.now().♻️ Example update (dynamic service period)
-from django.urls import reverse +from datetime import timedelta +from django.urls import reverse +from django.utils import timezone ... def _get_account_data(self, **overrides): + now = timezone.now() data = { "status": AccountStatusOptions.active.value, "billing_status": AccountBillingStatusOptions.open.value, "name": "Test Account", "service_period": { - "start": "2025-01-01T00:00:00Z", - "end": "2025-12-31T23:59:59Z", + "start": (now - timedelta(days=1)).isoformat(), + "end": (now + timedelta(days=365)).isoformat(), }, "patient": str(self.patient.external_id), }care/emr/tests/test_patient_api.py (1)
242-286: Split the extra validation block into its own test.Right now this method mixes delete-permission behavior with a date-of-birth/death validation scenario that’s unrelated, which makes the intent fuzzy. A dedicated test would keep each case crisp.
As per coding guidelines, "Prioritize readability and maintainability; follow Django's coding style guide (PEP 8 compliance)."
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3532 +/- ##
===========================================
+ Coverage 75.32% 76.18% +0.85%
===========================================
Files 473 473
Lines 22066 22066
Branches 2305 2305
===========================================
+ Hits 16622 16810 +188
+ Misses 4926 4736 -190
- Partials 518 520 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@nandkishorr Review! |
Proposed Changes
default_account action
AllFacilityViewSet public endpoint listing & search
Updated files
CRUD (create/list/delete)
missing fields, file name update
Skipped (already comprehensive)
Associated Issue
Architecture changes
Merge Checklist
/docsOnly PR's with test cases included and passing lint and test pipelines will be reviewed
@ohcnetwork/care-backend-maintainers @ohcnetwork/care-backend-admins
Summary by CodeRabbit