def test_delete(self): b = get_alpe_d_huez() response = self.client.post(reverse("booking.delete", kwargs=dict(pk=b.pk))) self.assertEqual(response.status_code, 302) # check booking try: b = get_alpe_d_huez() self.fail("booking was not deleted") except Booking.DoesNotExist: pass
def test_update(self): b = get_alpe_d_huez() response = self.client.post( reverse("booking.update.cottage", kwargs=dict(pk=b.pk)), dict(start_date=b.start_date, end_date=b.end_date, title="Zeal Monachorum"), ) self.assertEqual(response.status_code, 302) # check booking try: Booking.objects.get(title="Zeal Monachorum") except Booking.DoesNotExist: self.fail("cannot find updated booking")