@@ -23,6 +23,7 @@ def create_test_gsrs(cls):
2323 "kind" : GSR .KIND_WHARTON ,
2424 "image_url" : "https://s3.us-east-2.amazonaws.com/labs.api/gsr/lid-JMHH-gid-1.jpg" ,
2525 "in_use" : True ,
26+ "bookable_days" : 7 ,
2627 },
2728 )
2829 cls .agh_gsr , _ = GSR .objects .get_or_create (
@@ -33,6 +34,7 @@ def create_test_gsrs(cls):
3334 "kind" : GSR .KIND_PENNGROUPS ,
3435 "image_url" : "https://s3.us-east-2.amazonaws.com/labs.api/gsr/lid-20157-gid-42437.jpg" ,
3536 "in_use" : True ,
37+ "bookable_days" : 4 ,
3638 },
3739 )
3840 cls .weigle_gsr , _ = GSR .objects .get_or_create (
@@ -43,6 +45,7 @@ def create_test_gsrs(cls):
4345 "kind" : GSR .KIND_LIBCAL ,
4446 "image_url" : "https://s3.us-east-2.amazonaws.com/labs.api/gsr/lid-1086-gid-1889.jpg" ,
4547 "in_use" : True ,
48+ "bookable_days" : 7 ,
4649 },
4750 )
4851
@@ -104,11 +107,26 @@ def test_get_location(self):
104107 """Test that the locations endpoint returns all GSRs without auth checks"""
105108 response = self .client .get (reverse ("locations" ))
106109 res_json = json .loads (response .content )
110+ # TODO: add AGH back to availability route
107111 for entry in res_json :
108112 if entry ["id" ] == 1 :
109113 self .assertEquals (entry ["name" ], "Huntsman" )
114+ self .assertEquals (entry ["kind" ], GSR .KIND_WHARTON )
115+ self .assertEquals (entry ["lid" ], "JMHH" )
116+ self .assertEquals (entry ["gid" ], 1 )
117+ self .assertEquals (entry ["bookable_days" ], 7 )
110118 if entry ["id" ] == 2 :
119+ self .assertEquals (entry ["name" ], "Amy Gutmann Hall" )
120+ self .assertEquals (entry ["kind" ], GSR .KIND_PENNGROUPS )
121+ self .assertEquals (entry ["lid" ], "20157" )
122+ self .assertEquals (entry ["gid" ], 42437 )
123+ self .assertEquals (entry ["bookable_days" ], 4 )
124+ if entry ["id" ] == 3 :
111125 self .assertEquals (entry ["name" ], "Weigle" )
126+ self .assertEquals (entry ["kind" ], GSR .KIND_LIBCAL )
127+ self .assertEquals (entry ["lid" ], "1086" )
128+ self .assertEquals (entry ["gid" ], 1889 )
129+ self .assertEquals (entry ["bookable_days" ], 7 )
112130
113131 @mock .patch ("gsr_booking.views.WhartonGSRBooker.is_wharton" , return_value = False )
114132 @mock .patch ("gsr_booking.views.PennGroupsGSRBooker.is_seas" , return_value = False )
@@ -234,14 +252,15 @@ def test_recent(self):
234252 response = self .client .get (reverse ("recent-gsrs" ))
235253 res_json = json .loads (response .content )
236254 self .assertEqual (2 , len (res_json ))
237- self .assertEqual (6 , len (res_json [0 ]))
238- self .assertEqual (6 , len (res_json [1 ]))
255+ self .assertEqual (7 , len (res_json [0 ]))
256+ self .assertEqual (7 , len (res_json [1 ]))
239257 self .assertIn ("id" , res_json [0 ])
240258 self .assertIn ("kind" , res_json [0 ])
241259 self .assertIn ("lid" , res_json [0 ])
242260 self .assertIn ("gid" , res_json [0 ])
243261 self .assertIn ("name" , res_json [0 ])
244262 self .assertIn ("image_url" , res_json [0 ])
263+ self .assertIn ("bookable_days" , res_json [0 ])
245264 self .assertNotEqual (res_json [0 ]["id" ], res_json [1 ]["id" ])
246265
247266 @mock .patch ("gsr_booking.api_wrapper.WhartonBookingWrapper.is_wharton" , is_wharton_false )
0 commit comments