Skip to content

Commit

Permalink
Refactor PatientFilterTestCase to use base URL
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Jan 17, 2024
1 parent 36e2d69 commit f7d8c81
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions care/facility/tests/test_patient_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,12 @@ def setUpTestData(cls):
cls.patient.last_consultation = cls.consultation
cls.patient.save()

def get_base_url(self) -> str:
return "/api/v1/patient/"

def test_filter_by_patient_no(self):
self.client.force_authenticate(user=self.user)
response = self.client.get("/api/v1/patient/?patient_no=IP5678")
response = self.client.get(self.get_base_url(), {"patient_no": "IP5678"})
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data["count"], 1)
self.assertEqual(
Expand All @@ -257,7 +260,11 @@ def test_filter_by_patient_no(self):
def test_filter_by_location(self):
self.client.force_authenticate(user=self.user)
response = self.client.get(
f"/api/v1/patient/?facility={self.facility.external_id}&location={self.location.external_id}"
self.get_base_url(),
{
"facility": self.facility.external_id,
"location": self.location.external_id,
},
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data["count"], 1)
Expand Down

0 comments on commit f7d8c81

Please sign in to comment.