Skip to content

Commit a00d15a

Browse files
fixed failing tests and added unique tests
1 parent d00baaa commit a00d15a

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

backend/npdfhir/tests.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,45 @@ def test_list_filter_by_organization_type(self):
184184
self.assertEqual(response.status_code, status.HTTP_200_OK)
185185
self.assertIn("results", response.data)
186186

187+
def test_list_filter_by_npi_general(self):
188+
url = reverse("fhir-organization-list")
189+
response = self.client.get(url, {"identifier":"1427051473"})
190+
self.assertEqual(response.status_code, status.HTTP_200_OK)
191+
self.assertIn("results", response.data)
192+
193+
def test_list_filter_by_npi_specific(self):
194+
url = reverse("fhir-organization-list")
195+
response = self.client.get(url, {"identifier":"NPI|1427051473"})
196+
self.assertEqual(response.status_code, status.HTTP_200_OK)
197+
self.assertIn("results", response.data)
198+
199+
# this test data is not in the database yet so no point of including them but this is what the test should look like when we eventually do get them in
200+
201+
# def test_list_filter_by_ein_general(self):
202+
# url = reverse("fhir-organization-list")
203+
# response = self.client.get(url, {"identifier":"12-3456789"})
204+
# self.assertEqual(response.status_code, status.HTTP_200_OK)
205+
# self.assertIn("results", response.data)
206+
207+
# def test_list_filter_by_ein_specific(self):
208+
# url = reverse("fhir-organization-list")
209+
# response = self.client.get(url, {"identifier":"USEIN|12-3456789"})
210+
# self.assertEqual(response.status_code, status.HTTP_200_OK)
211+
# self.assertIn("results", response.data)
212+
# def test_list_filter_by_otherID_general(self):
213+
# url = reverse("fhir-organization-list")
214+
# response = self.client.get(url, {"identifier":"1EG4-TE5-MK73"})
215+
# self.assertEqual(response.status_code, status.HTTP_200_OK)
216+
# self.assertIn("results", response.data)
217+
218+
# def test_list_filter_by_otherID_specific(self):
219+
# url = reverse("fhir-organization-list")
220+
# response = self.client.get(url, {"identifier":" CmsMBI|1EG4-TE5-MK73"})
221+
# self.assertEqual(response.status_code, status.HTTP_200_OK)
222+
# self.assertIn("results", response.data)
223+
187224
def test_retrieve_nonexistent(self):
188-
url = reverse("fhir-organization-detail", args=[999999])
225+
url = reverse("fhir-organization-detail", args=["12300000-0000-0000-0000-000000000123"])
189226
response = self.client.get(url)
190227
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
191228

@@ -246,6 +283,6 @@ def test_list_filter_by_practitioner_type(self):
246283
self.assertIn("results", response.data)
247284

248285
def test_retrieve_nonexistent(self):
249-
url = reverse("fhir-practitioner-detail", args=[999999])
286+
url = reverse("fhir-practitioner-detail", args=["12300000-0000-0000-0000-000000000123"])
250287
response = self.client.get(url)
251288
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)

backend/npdfhir/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def list(self, request):
429429
case 'organization_type':
430430
organizations = organizations.annotate(
431431
search=SearchVector(
432-
'organizationtotaxonomy__nucc_code__display_name')
432+
'clinicalorganization__organizationtotaxonomy__nucc_code__display_name')
433433
).filter(search=value)
434434
case 'address':
435435
organizations = organizations.annotate(

0 commit comments

Comments
 (0)