@@ -54,15 +54,23 @@ def setUp(self):
5454 @mock .patch ("gsr_booking.views.WhartonGSRBooker.is_wharton" , return_value = False )
5555 @mock .patch ("gsr_booking.views.PennGroupsGSRBooker.is_seas" , return_value = False )
5656 def test_get_location (self , mock_is_seas , mock_is_wharton ):
57+ """Test that regular users do not see Wharton or PennGroups GSRs"""
5758 response = self .client .get (reverse ("locations" ))
5859 res_json = json .loads (response .content )
60+
61+ # Regular users should NOT see Wharton or PennGroups GSRs
62+ # Verify that Huntsman (Wharton), Amy Gutmann Hall (PennGroups),
63+ # and Academic Research (Wharton) are not in the response
64+ gsr_ids = [entry ["id" ] for entry in res_json ]
65+ self .assertNotIn (1 , gsr_ids , "Regular users should not see Huntsman (Wharton GSR)" )
66+ self .assertNotIn (
67+ 2 , gsr_ids , "Regular users should not see Amy Gutmann Hall (PennGroups GSR)"
68+ )
69+ self .assertNotIn (3 , gsr_ids , "Regular users should not see Academic Research (Wharton GSR)" )
70+
71+ # Verify all returned GSRs are LibCal
5972 for entry in res_json :
60- if entry ["id" ] == 1 :
61- self .assertEquals (entry ["name" ], "Huntsman" )
62- if entry ["id" ] == 2 :
63- self .assertEquals (entry ["name" ], "Amy Gutmann Hall" )
64- if entry ["id" ] == 3 :
65- self .assertEquals (entry ["name" ], "Academic Research" )
73+ self .assertEqual (entry ["kind" ], GSR .KIND_LIBCAL )
6674
6775 @mock .patch ("gsr_booking.views.WhartonGSRBooker.is_wharton" , return_value = False )
6876 @mock .patch ("gsr_booking.views.PennGroupsGSRBooker.is_seas" , return_value = False )
@@ -131,6 +139,8 @@ def test_get_location_wharton_seas_user(self, mock_is_seas, mock_is_wharton):
131139 def test_get_location_penn_labs_member (self ):
132140 """Test that Penn Labs members see all GSRs regardless of their individual status"""
133141 # Add user to Penn Labs group
142+ print ("GSR count:" , GSR .objects .count ()) # Test that all GSRs are loaded
143+
134144 penn_labs_group = Group .objects .get (name = "Penn Labs" )
135145 GroupMembership .objects .create (
136146 user = self .user , group = penn_labs_group , accepted = True , type = GroupMembership .MEMBER
0 commit comments