Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added tests for beds endpoints #2104

Merged
merged 10 commits into from
Jul 12, 2024
Prev Previous commit
Next Next commit
added count check
DraKen0009 committed May 15, 2024
commit b7899864e601e68e20cbff6a0842551f396e3cb6
10 changes: 7 additions & 3 deletions care/facility/tests/test_bed_api.py
Original file line number Diff line number Diff line change
@@ -46,18 +46,22 @@ def test_list_beds(self):
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data["count"], 3)

response = self.client.get("/api/v1/bed/?bed_type=ISOLATION")
response = self.client.get("/api/v1/bed/", {"bed_type": "ISOLATION"})
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data["results"][0]["name"], self.bed2.name)
self.assertEqual(response.data["count"], 1)

response = self.client.get(
f"/api/v1/bed/?facility={self.facility2.external_id}"
"/api/v1/bed/",
{"facility": self.facility2.external_id},
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data["results"][0]["name"], self.bed3.name)
self.assertEqual(response.data["count"], 1)

response = self.client.get(
f"/api/v1/bed/?location={self.asset_location2.external_id}"
"/api/v1/bed/",
{"location": self.asset_location2.external_id},
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data["count"], 1)