@@ -56,7 +56,7 @@ def setUp(self):
5656 def test_create_share_code_success (self ):
5757 # Creates a gsr share code successfully
5858 self .client .force_authenticate (user = self .owner )
59- response = self .client .post ("/api/gsr/share/" , {"booking_id" : self .booking .id })
59+ response = self .client .post ("/api/gsr/share/" , {"booking_id" : self .booking .booking_id })
6060 self .assertEqual (response .status_code , 201 )
6161 payload = json .loads (response .content )
6262
@@ -72,13 +72,13 @@ def test_create_share_code_duplicate(self):
7272 self .client .force_authenticate (user = self .owner )
7373
7474 # First creation
75- response1 = self .client .post ("/api/gsr/share/" , {"booking_id" : self .booking .id })
75+ response1 = self .client .post ("/api/gsr/share/" , {"booking_id" : self .booking .booking_id })
7676 self .assertEqual (response1 .status_code , 201 )
7777 payload1 = json .loads (response1 .content )
7878 first_code = payload1 ["code" ]
7979
8080 # Second creation (should return existing code)
81- response2 = self .client .post ("/api/gsr/share/" , {"booking_id" : self .booking .id })
81+ response2 = self .client .post ("/api/gsr/share/" , {"booking_id" : self .booking .booking_id })
8282 self .assertEqual (response2 .status_code , 201 ) # Changed from 200 to 201
8383 payload2 = json .loads (response2 .content )
8484
@@ -89,7 +89,7 @@ def test_create_share_code_duplicate(self):
8989 self .assertEqual (GSRShareCode .objects .filter (booking = self .booking ).count (), 1 )
9090
9191 def test_create_share_code_without_auth (self ):
92- response = self .client .post ("/api/gsr/share/" , {"booking_id" : self .booking .id })
92+ response = self .client .post ("/api/gsr/share/" , {"booking_id" : self .booking .booking_id })
9393 self .assertEqual (response .status_code , 403 )
9494 self .assertEqual (GSRShareCode .objects .count (), 0 )
9595
@@ -217,7 +217,7 @@ def test_create_share_code_for_expired_booking_code_invalid(self):
217217 self .booking .save (update_fields = ["end" ])
218218
219219 self .client .force_authenticate (user = self .owner )
220- response = self .client .post ("/api/gsr/share/" , {"booking_id" : self .booking .id })
220+ response = self .client .post ("/api/gsr/share/" , {"booking_id" : self .booking .booking_id })
221221 self .assertEqual (response .status_code , 201 )
222222 payload = json .loads (response .content )
223223 self .assertEqual (payload ["status" ], "expired" )
@@ -247,7 +247,7 @@ def test_create_share_code_replaces_expired(self):
247247
248248 # Create again
249249 self .client .force_authenticate (user = self .owner )
250- response = self .client .post ("/api/gsr/share/" , {"booking_id" : self .booking .id })
250+ response = self .client .post ("/api/gsr/share/" , {"booking_id" : self .booking .booking_id })
251251 self .assertEqual (response .status_code , 201 ) # Changed from 200 to 201
252252 payload = json .loads (response .content )
253253
0 commit comments