def test_user_cannot_update_reservation_in_past(self): self.client.login(username=self.user.email, password='******') reservation = ReservationFactory(start=timezone.now() - timedelta(minutes=15), end=timezone.now() - timedelta(hours=1, minutes=15), user=self.user, paid=True) response = self.client.get(ReservationFactory.get_reservation_detail_url(reservation.id)) self.assertEqual(response.status_code, http_client.NOT_FOUND)
def test_user_cannot_update_other_user_reservation(self): self.client.login(username=self.user.email, password='******') other_reservation = ReservationFactory(paid=True) response = self.client.get( ReservationFactory.get_reservation_detail_url( other_reservation.id)) self.assertEqual(response.status_code, http_client.NOT_FOUND)
def test_user_cannot_update_reservation_in_past(self): self.client.login(username=self.user.email, password='******') reservation = ReservationFactory( start=timezone.now() - timedelta(minutes=15), end=timezone.now() - timedelta(hours=1, minutes=15), user=self.user, paid=True) response = self.client.get( ReservationFactory.get_reservation_detail_url(reservation.id)) self.assertEqual(response.status_code, http_client.NOT_FOUND)
def test_user_cannot_update_other_user_reservation(self): self.client.login(username=self.user.email, password='******') other_reservation = ReservationFactory(paid=True) response = self.client.get(ReservationFactory.get_reservation_detail_url(other_reservation.id)) self.assertEqual(response.status_code, http_client.NOT_FOUND)
def setUp(self): self.user = UserFactory(is_active=True) self.reservation = ReservationFactory(user=self.user) self.detail_url = ReservationFactory.get_reservation_detail_url(self.reservation.id)
def setUp(self): self.user = UserFactory(is_active=True) self.reservation = ReservationFactory(user=self.user) self.detail_url = ReservationFactory.get_reservation_detail_url( self.reservation.id)