-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#887 Exclude not active crumbs siblings #892
Conversation
@@ -20,7 +21,7 @@ | |||
from django.utils.translation import ugettext as _ | |||
|
|||
from catalog.helpers import reverse_catalog_url | |||
from pages.models import CustomPage | |||
from pages import models as pages_models |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from pages import models as pages_models | |
import pages |
pages.models
has the same length, but wider scope, so i'd prefer it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@artemiy312 , some django models preprocessing black magic does not allow us to use just pages.models
appropriately. I'll create subtask about it for research and possible renaming all over the system
@@ -527,20 +531,33 @@ def test_tags_pagination_has_canonical_links(self): | |||
) | |||
) | |||
|
|||
def test_category_matrix_page(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like an accidentally removed test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@artemiy312 , it's just moved to shopelectro.tests.tests_views.CategoriesMatrix#test_roots_sorting
with another task. I just removed code old doubling
shopelectro/tests/tests_views.py
Outdated
# The test below proves the bug. Now fix it. | ||
@unittest.expectedFailure | ||
def test_crumb_siblings_are_active(self): | ||
parent = models.Category.objects.raw( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems it is the same, but simpler
parent = models.Category.objects.raw( | |
parent = models.Category.objects.annotate(c=Count('children')).filter(c__gt=1).first() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! I'll try it
shopelectro/tests/tests_views.py
Outdated
category = parent.children.active().first() | ||
soup = self.get_category_soup(category.children.active().first()) | ||
siblings = soup.select('.breadcrumbs-siblings-links a') | ||
self.assertTrue(all([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you
self.assertTrue(all([ | |
self.assertFalse(models.Category.objects.filter( | |
name__in=[s.text.strip() for s in siblings], | |
page__is_active=False, | |
).exists()) |
Closes #887