Example #1
0
 def test_that_favorites_url_with_user_returns_200(self):
     request = self.factory.get('/favorites/')
     request.session = self.session
     request.session['user'] = self.user
     request.user = self.user
     response = favorites(request)
     self.assertEquals(response.status_code, 200)
Example #2
0
 def test_that_favorites_url_with_anon_user_returns_403(self):
     request = self.factory.get('/favorites/')
     request.session = self.session
     request.session['user'] = self.anon_user
     request.user = self.anon_user
     try:
         response = favorites(request)
         self.assertEquals('Anonymous User', 'Accessed mark_as_barista url')
     except (PermissionDenied):
         self.assertEquals('Permission was denied', 'Permission was denied')