Exemplo n.º 1
0
 def test_reservation_deny(self):
     self.client = Client()
     donor = createdonor()
     donation_post = createdonation(donor)
     helpseeker = creathelpseeker()
     reservation = ReservationPost(
         dropoff_time_request=donation_post.dropoff_time_3,
         post=donation_post,
         donor=donor,
         helpseeker=helpseeker,
     )
     reservation.save()
     notification = Notification(
         post=reservation,
         sender=helpseeker,
         receiver=donor,
         date_created=timezone.now(),
     )
     notification.save()
     self.client.force_login(donor, backend=None)
     confirmation = self.client.post(
         reverse("reservation:confirm-notification", kwargs={"id": 1}),
         data={
             "deny": True,
         },
     )
     self.assertEqual(confirmation.status_code, 302)
Exemplo n.º 2
0
 def test_reservation_update_slot3(self):
     self.client = Client()
     donor = createdonor()
     donation_post = createdonation2(donor)
     helpseeker = creathelpseeker()
     reservation = ReservationPost(
         dropoff_time_request=donation_post.dropoff_time_3,
         post=donation_post,
         donor=donor,
         helpseeker=helpseeker,
     )
     reservation.save()
     notification = Notification(
         post=reservation,
         sender=helpseeker,
         receiver=donor,
         date_created=timezone.now(),
     )
     notification.save()
     self.client.force_login(helpseeker, backend=None)
     holder = self.client.get(
         reverse("reservation:reservation-update-request", kwargs={"pk": 1}),
         data={
             "dropoff_time": 3,
         },
     )
     self.assertEqual(holder.status_code, 302)
Exemplo n.º 3
0
 def test_reservation_str(self):
     donor = createdonor()
     helpseeker = creathelpseeker()
     donation_post = createdonation(donor)
     reservation = ReservationPost(
         dropoff_time_request=donation_post.dropoff_time_1,
         post=donation_post,
         donor=donor,
         helpseeker=helpseeker,
     )
     reservation.save()
     notification = Notification(
         post=reservation,
         sender=helpseeker,
         receiver=donor,
         date_created=timezone.now(),
     )
     notification.save()
     self.assertEquals(
         str(notification.sender.username)
         + " to "
         + str(notification.receiver.username)
         + " for "
         + str(notification.post.post.title),
         notification.__str__(),
     )
Exemplo n.º 4
0
 def test_notification_model_save(self):
     donor = createdonor()
     helpseeker = creathelpseeker()
     donation_post = createdonation(donor)
     reservation = ReservationPost(
         dropoff_time_request=donation_post.dropoff_time_1,
         post=donation_post,
         donor=donor,
         helpseeker=helpseeker,
     )
     reservation.save()
     notification = Notification(
         post=reservation,
         sender=helpseeker,
         receiver=donor,
         date_created=timezone.now(),
     )
     self.assertIsNone(notification.save())
Exemplo n.º 5
0
 def test_reservation_cancel(self):
     self.client = Client()
     donor = createdonor()
     donation_post = createdonation2(donor)
     helpseeker = creathelpseeker()
     reservation = ReservationPost(
         dropoff_time_request=donation_post.dropoff_time_3,
         post=donation_post,
         donor=donor,
         helpseeker=helpseeker,
     )
     reservation.save()
     notification = Notification(
         post=reservation,
         sender=helpseeker,
         receiver=donor,
         date_created=timezone.now(),
     )
     notification.save()
     self.client.force_login(helpseeker, backend=None)
     holder = self.client.get("/reservation/cancel/1")
     self.assertEqual(holder.status_code, 302)
Exemplo n.º 6
0
 def test_read_messages(self):
     donor = createdonor()
     helpseeker = creathelpseeker()
     donation_post = createdonation(donor)
     reservation = ReservationPost(
         dropoff_time_request=donation_post.dropoff_time_1,
         post=donation_post,
         donor=donor,
         helpseeker=helpseeker,
     )
     reservation.save()
     notification = Notification(
         post=reservation,
         sender=helpseeker,
         receiver=donor,
         date_created=timezone.now(),
     )
     notification.save()
     response = self.client.get(
         reverse("reservation:read-message", args=(notification.id,))
     )
     self.assertEqual(response.status_code, 302)
Exemplo n.º 7
0
 def test_notification_expire(self):
     self.client = Client()
     donor = createdonor()
     donation_post = createdonation3(donor)
     helpseeker = creathelpseeker()
     reservation = ReservationPost(
         dropoff_time_request=donation_post.dropoff_time_3,
         post=donation_post,
         donor=donor,
         helpseeker=helpseeker,
     )
     reservation.save()
     notification = Notification(
         post=reservation,
         sender=helpseeker,
         receiver=donor,
         date_created=timezone.now(),
     )
     notification.save()
     self.client.force_login(donor, backend=None)
     holder = self.client.get(reverse("reservation:ajax-notification"))
     self.assertEqual(holder.status_code, 200)
Exemplo n.º 8
0
 def test_notification_model_status(self):
     donor = createdonor()
     helpseeker = creathelpseeker()
     donation_post = createdonation(donor)
     reservation = ReservationPost(
         dropoff_time_request=1,
         post=donation_post,
         donor=donor,
         helpseeker=helpseeker,
     )
     notification = Notification(
         post=reservation,
         sender=helpseeker,
         receiver=donor,
         date=timezone.now(),
     )
     self.assertEqual(notification.notificationstatus, 3)