Fix failures in menu tests

This commit is contained in:
Iacopo Spalletti 2017-05-07 04:51:51 +02:00
parent b932f7bddb
commit edd96b6dc6
No known key found for this signature in database
GPG key ID: BDCBC2EB289F60C6

View file

@ -45,6 +45,7 @@ class MenuTest(BaseTest):
for lang in ('en', 'it'):
with smart_override(lang):
self._reset_menus()
request = self.get_page_request(pages[1], self.user, pages[1].get_absolute_url(lang))
nodes = menu_pool.get_nodes(request)
nodes_url = set([node.url for node in nodes])
@ -55,6 +56,7 @@ class MenuTest(BaseTest):
posts[0].categories.clear()
for lang in ('en', 'it'):
with smart_override(lang):
self._reset_menus()
request = self.get_page_request(pages[1], self.user, pages[1].get_absolute_url(lang))
nodes = menu_pool.get_nodes(request)
nodes_url = set([node.url for node in nodes])
@ -75,6 +77,7 @@ class MenuTest(BaseTest):
for lang in languages:
with smart_override(lang):
self._reset_menus()
cats_url[lang] = set([cat.get_absolute_url() for cat in self.cats if cat.has_translation(lang)])
posts_url[lang] = set([post.get_absolute_url(lang) for post in posts if post.has_translation(lang) and post.app_config == self.app_config_1])
@ -85,6 +88,7 @@ class MenuTest(BaseTest):
for lang in languages:
request = self.get_page_request(None, self.user, r'/%s/page-two/' % lang)
with smart_override(lang):
self._reset_menus()
nodes = menu_pool.get_nodes(request)
nodes_url = set([node.url for node in nodes])
self.assertFalse(cats_url[lang].issubset(nodes_url))
@ -97,6 +101,7 @@ class MenuTest(BaseTest):
for lang in languages:
request = self.get_page_request(None, self.user, r'/%s/page-two/' % lang)
with smart_override(lang):
self._reset_menus()
nodes = menu_pool.get_nodes(request)
nodes_url = set([node.url for node in nodes])
self.assertFalse(cats_url[lang].issubset(nodes_url))
@ -109,6 +114,7 @@ class MenuTest(BaseTest):
for lang in languages:
request = self.get_page_request(None, self.user, r'/%s/page-two/' % lang)
with smart_override(lang):
self._reset_menus()
nodes = menu_pool.get_nodes(request)
nodes_url = set([node.url for node in nodes])
self.assertTrue(cats_url[lang].issubset(nodes_url))
@ -121,6 +127,7 @@ class MenuTest(BaseTest):
for lang in languages:
request = self.get_page_request(None, self.user, r'/%s/page-two/' % lang)
with smart_override(lang):
self._reset_menus()
nodes = menu_pool.get_nodes(request)
nodes_url = set([node.url for node in nodes])
self.assertTrue(cats_url[lang].issubset(nodes_url))