Skip to content

Commit

Permalink
#444  Test products list on 404 page
Browse files Browse the repository at this point in the history
Signed-off-by: duker33 <duker33@gmail.com>
  • Loading branch information
duker33 committed Aug 1, 2018
1 parent 8a82161 commit 8bd4fba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions shopelectro/tests/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,18 @@ def test_orphan_product(self):
response = self.client.get(product.url)
self.assertEqual(response.status_code, 404)

def test_related_products_on_404(self):
product = Product.objects.first()
product.page.is_active = False
product.save() # saves product.page too

response = self.client.get(product.url)
sibling_product = product.category.products.last()
self.assertEqual(response.status_code, 404)
self.assertTrue(
sibling_product.name in str(response.content)
)


class ProductPageSchema(TestCase):

Expand Down

0 comments on commit 8bd4fba

Please sign in to comment.