Ejemplo n.º 1
0
 def test_that_update_favs_url_with_anon_user_returns_403(self):
     request = self.factory.post('/updateFavs/', {'companyID': 1, 'baristaID': self.barista.id})
     request.session = self.session
     request.session['user'] = self.anon_user
     request.user = self.anon_user
     try:
         response = update_favs(request)
         self.assertEquals('Anonymous User', 'Accessed mark_as_barista url')
     except (PermissionDenied):
         self.assertEquals('Permission was denied', 'Permission was denied')
Ejemplo n.º 2
0
 def test_that_update_favs_url_with_user_returns_200_and_updates_favs_properly(self):
     request = self.factory.post('/updateFavs/', {'companyID': 1, 'baristaID': self.barista.id})
     request.session = self.session
     request.session['user'] = self.barista
     request.user = self.barista
     response = update_favs(request)
     self.assertEquals(response.status_code, 200)
     userdetails = request.session['user'].get_profile()
     self.assertEquals(userdetails.favBaristaObj, self.baristadetails)
     self.assertEquals(userdetails.favCompany.id, 1)