Skip to content

Commit

Permalink
#887 Test if all crumb siblings are active
Browse files Browse the repository at this point in the history
  • Loading branch information
duker33 committed Jun 21, 2019
1 parent 9adf528 commit 028cced
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions shopelectro/tests/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,30 @@ def test_tags_pagination_has_canonical_links(self):
)
)

def test_crumb_siblings_are_active(self):
category = models.Category.objects.raw(
'SELECT * FROM shopelectro_category AS P'
' WHERE P.id = ('
' SELECT C.parent_id FROM shopelectro_category as C'
' GROUP BY C.parent_id'
' HAVING COUNT(C.parent_id) > 1'
' LIMIT 1'
' )'
)[0]
(
pages_models.Page.objects
.filter(id=category.children.first().page.id)
.update(is_active=False)
)
soup = self.get_category_soup(category.children.active().first())
siblings = soup.select('.breadcrumbs-siblings-links a')
self.assertTrue(all([
c.page.is_active for c in (
models.Category.objects
.filter(name__in=[s.text.strip() for s in siblings])
)
]))


@tag('fast', 'catalog')
class CategoriesMatrix(BaseCatalogTestCase):
Expand Down

0 comments on commit 028cced

Please sign in to comment.