Example #1
0
 def test_user_does_not_get_other_user_reservations(self):
     ReservationFactory.create_batch(3, paid=True)
     data = {
         'month': timezone.datetime.today().month,
         'year': timezone.datetime.today().year
     }
     self._ensure_table_has_not_been_created(data)
Example #2
0
 def test_all_users_unpaid_reservations_are_deleted(self):
     self.client.login(**self.login_data)
     ReservationFactory.create_batch(3, user=self.user)
     self.client.post(self.remove_all_url,
                      HTTP_X_REQUESTED_WITH="XMLHttpRequest")
     self.assertEqual(Reservation.objects.all().count(), 0,
                      _("Not all unpaid reservations are deleted"))
Example #3
0
 def test_user_does_not_get_other_user_reservations(self):
     ReservationFactory.create_batch(3, paid=True)
     data = {
         'month': timezone.datetime.today().month,
         'year': timezone.datetime.today().year
     }
     self._ensure_table_has_not_been_created(data)
Example #4
0
 def test_user_can_see_multiple_unpaid_reservations(self):
     ReservationFactory.create_batch(3, user=self.user)
     self.client.login(**self.login_data)
     response = self.client.get(ReservationFactory.get_reservation_list_url(),
                                {'start': timezone.now().date(), 'end': timezone.now().date()})
     reservations = [reserv for reserv in response.context_data['table'].data]
     self.assertEqual(len(reservations), 3, _("All three reservations are shown"))
Example #5
0
 def test_user_can_see_multiple_unpaid_reservations(self):
     ReservationFactory.create_batch(3, user=self.user)
     self.client.login(**self.login_data)
     response = self.client.get(
         ReservationFactory.get_reservation_list_url(), {
             'start': timezone.now().date(),
             'end': timezone.now().date()
         })
     reservations = [
         reserv for reserv in response.context_data['table'].data
     ]
     self.assertEqual(len(reservations), 3,
                      _("All three reservations are shown"))
Example #6
0
 def test_all_users_unpaid_reservations_are_deleted(self):
     self.client.login(**self.login_data)
     ReservationFactory.create_batch(3, user=self.user)
     self.client.post(self.remove_all_url, HTTP_X_REQUESTED_WITH="XMLHttpRequest")
     self.assertEqual(Reservation.objects.all().count(), 0,
                      _("Not all unpaid reservations are deleted"))