Example #1
0
    def test_get_queryset_not_published(self):
        """
         Test that the queryset returned is as expected a LettingQuerySet
         """
        sale = SaleFactory.create(status=Sale.STATUS_CHOICE_INACTIVE)

        request = self.factory.get(
            reverse('sales:detail', kwargs={'slug': sale.slug}))

        request.user = AnonymousUser()

        with self.assertRaises(Http404):
            DetailPageView.as_view()(request, slug=sale.slug)
Example #2
0
    def test_get_queryset_expired(self):
        """
         Test that the queryset returned is as expected a LettingQuerySet
         """
        expired_date = datetime.utcnow().replace(tzinfo=pytz.utc) - timedelta(
            days=1)
        sale = SaleFactory.create(expires_at=expired_date)

        request = self.factory.get(
            reverse('sales:detail', kwargs={'slug': sale.slug}))

        request.user = AnonymousUser()

        with self.assertRaises(Http404):
            DetailPageView.as_view()(request, slug=sale.slug)