-
Notifications
You must be signed in to change notification settings - Fork 0
added fields to GSRSharedCodeSerializer #391
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -117,13 +117,22 @@ def test_view_shared_booking_public_access(self): | |||||
| payload = json.loads(response.content) | ||||||
|
|
||||||
| # Should only contain booking info and not owner info | ||||||
| print("Payload: ", payload) | ||||||
|
minghansun1 marked this conversation as resolved.
|
||||||
| self.assertIn("booking_id", payload) | ||||||
| self.assertIn("gsr", payload) | ||||||
| self.assertIn("lid", payload["gsr"]) | ||||||
| self.assertIn("gid", payload["gsr"]) | ||||||
| self.assertIn("name", payload["gsr"]) | ||||||
| self.assertIn("kind", payload["gsr"]) | ||||||
| self.assertIn("image_url", payload["gsr"]) | ||||||
| self.assertIn("room_name", payload) | ||||||
| self.assertIn("building", payload) | ||||||
| self.assertIn("room_id", payload) | ||||||
| self.assertIn("start", payload) | ||||||
| self.assertIn("end", payload) | ||||||
| self.assertIn("is_valid", payload) | ||||||
| self.assertIn("owner_name", payload) | ||||||
|
minghansun1 marked this conversation as resolved.
|
||||||
| self.assertEqual(payload["room_name"], self.booking.room_name) | ||||||
| self.assertEqual(payload["building"], self.booking.gsr.name) | ||||||
| self.assertEqual(payload["gsr"]["name"], self.booking.gsr.name) | ||||||
| self.assertEqual(payload["is_valid"], True) | ||||||
|
|
||||||
| def test_view_shared_booking_invalid_code(self): | ||||||
|
|
@@ -304,17 +313,24 @@ def test_shared_booking_serializer(self): | |||||
| data = serializer.data | ||||||
|
|
||||||
| # Should have booking details | ||||||
| self.assertIn("booking_id", data) | ||||||
| self.assertIn("gsr", data) | ||||||
| self.assertIn("lid", data["gsr"]) | ||||||
| self.assertIn("gid", data["gsr"]) | ||||||
| self.assertIn("name", data["gsr"]) | ||||||
| self.assertIn("kind", data["gsr"]) | ||||||
| self.assertIn("image_url", data["gsr"]) | ||||||
| self.assertIn("room_name", data) | ||||||
| self.assertIn("building", data) | ||||||
| self.assertIn("room_id", data) | ||||||
| self.assertIn("start", data) | ||||||
| self.assertIn("end", data) | ||||||
| self.assertIn("is_valid", data) | ||||||
| self.assertIn("owner_name", data) | ||||||
|
|
||||||
| # Should not have owner info | ||||||
|
||||||
| # Should not have owner info | |
| # Should not expose owner-related model fields (only owner_name is allowed) |
Uh oh!
There was an error while loading. Please reload this page.