Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added ShowSubMenuCheck tests to check for show_sub_menu bug

  • Loading branch information...
commit 91e1bd3eb1443ee1ba9452f01d1ce8ea9d7d360d 1 parent 5dddfa2
@yakky yakky authored
View
2  cms/tests/__init__.py
@@ -2,7 +2,7 @@
from cms.tests.admin import AdminTestCase
from cms.tests.apphooks import ApphooksTestCase
from cms.tests.docs import DocsTestCase
-from cms.tests.menu import FixturesMenuTests, MenuTests, AdvancedSoftrootTests
+from cms.tests.menu import FixturesMenuTests, MenuTests, AdvancedSoftrootTests, ShowSubMenuCheck
from cms.tests.navextender import NavExtenderTestCase
from cms.tests.nonroot import NonRootCase
from cms.tests.page import PagesTestCase, NoAdminPageTests
View
27 cms/tests/menu.py
@@ -716,4 +716,29 @@ def test_02_top_in_nav(self):
AttributeObject(title='bbb', level=1, children=[])
])
]
- self.assertTreeQuality(soft_root, mock_tree, 'title', 'level')
+ self.assertTreeQuality(soft_root, mock_tree, 'title', 'level')
+
+
+class ShowSubMenuCheck(BaseMenuTest):
+ """
+ Tree from fixture:
+
+ + P1
+ | + P2
+ | + P3
+ + P4
+ | + P5
+ + P6
+ + P7 (not in menu)
+ + P8
+ """
+ fixtures = ['menus-sub.json']
+
+ def test_01_show_submenu(self):
+ context = self.get_context('/test-page-6/')
+ # test standard show_menu
+ tpl = Template("{% load menu_tags %}{% show_sub_menu %}")
+ tpl.render(context)
+ nodes = context['children']
+ self.assertEqual(len(nodes), 1)
+ self.assertEqual(nodes[0].id, 8)
View
1  tests/testapp/fixtures/menus-sub.json
@@ -0,0 +1 @@
+[{"pk": 1, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 2, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 3, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 4, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 5, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 6, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 7, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 8, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 9, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 10, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 11, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 12, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 13, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 14, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 15, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 16, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 17, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 18, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 19, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 20, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 21, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 22, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 23, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 24, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 25, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 26, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 27, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 28, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 29, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 30, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 31, "model": "cms.placeholder", "fields": {"slot": "right-column", "default_width": null}}, {"pk": 32, "model": "cms.placeholder", "fields": {"slot": "body", "default_width": null}}, {"pk": 1, "model": "cms.page", "fields": {"rght": 6, "navigation_extenders": null, "site": 1, "creation_date": "2011-01-22 17:07:09", "lft": 1, "in_navigation": true, "reverse_id": null, "login_required": false, "created_by": "script", "publication_end_date": null, "moderator_state": 0, "template": "nav_playground.html", "tree_id": 1, "placeholders": [1, 2], "limit_visibility_in_menu": null, "parent": null, "publisher_state": 1, "soft_root": false, "publication_date": "2011-01-22 17:07:09", "publisher_public": null, "level": 0, "changed_by": "script", "publisher_is_draft": true, "published": true}}, {"pk": 2, "model": "cms.page", "fields": {"rght": 5, "navigation_extenders": null, "site": 1, "creation_date": "2011-01-22 17:07:09", "lft": 2, "in_navigation": true, "reverse_id": null, "login_required": false, "created_by": "script", "publication_end_date": null, "moderator_state": 0, "template": "nav_playground.html", "tree_id": 1, "placeholders": [3, 4], "limit_visibility_in_menu": null, "parent": 1, "publisher_state": 1, "soft_root": false, "publication_date": "2011-01-22 17:07:09", "publisher_public": null, "level": 1, "changed_by": "script", "publisher_is_draft": true, "published": true}}, {"pk": 3, "model": "cms.page", "fields": {"rght": 4, "navigation_extenders": null, "site": 1, "creation_date": "2011-01-22 17:07:10", "lft": 3, "in_navigation": true, "reverse_id": null, "login_required": false, "created_by": "script", "publication_end_date": null, "moderator_state": 0, "template": "nav_playground.html", "tree_id": 1, "placeholders": [5, 6], "limit_visibility_in_menu": null, "parent": 2, "publisher_state": 1, "soft_root": false, "publication_date": "2011-01-22 17:07:10", "publisher_public": null, "level": 2, "changed_by": "script", "publisher_is_draft": true, "published": true}}, {"pk": 4, "model": "cms.page", "fields": {"rght": 4, "navigation_extenders": null, "site": 1, "creation_date": "2011-01-22 17:07:10", "lft": 1, "in_navigation": true, "reverse_id": null, "login_required": false, "created_by": "script", "publication_end_date": null, "moderator_state": 0, "template": "nav_playground.html", "tree_id": 2, "placeholders": [7, 8], "limit_visibility_in_menu": null, "parent": null, "publisher_state": 1, "soft_root": false, "publication_date": "2011-01-22 17:07:10", "publisher_public": null, "level": 0, "changed_by": "script", "publisher_is_draft": true, "published": true}}, {"pk": 5, "model": "cms.page", "fields": {"rght": 3, "navigation_extenders": null, "site": 1, "creation_date": "2011-01-22 17:07:11", "lft": 2, "in_navigation": true, "reverse_id": null, "login_required": false, "created_by": "script", "publication_end_date": null, "moderator_state": 0, "template": "nav_playground.html", "tree_id": 2, "placeholders": [9, 10], "limit_visibility_in_menu": null, "parent": 4, "publisher_state": 1, "soft_root": false, "publication_date": "2011-01-22 17:07:11", "publisher_public": null, "level": 1, "changed_by": "script", "publisher_is_draft": true, "published": true}}, {"pk": 6, "model": "cms.page", "fields": {"rght": 6, "navigation_extenders": null, "site": 1, "creation_date": "2011-01-22 17:07:12", "lft": 1, "in_navigation": true, "reverse_id": null, "login_required": false, "created_by": "script", "publication_end_date": null, "moderator_state": 0, "template": "nav_playground.html", "tree_id": 3, "placeholders": [11, 12], "limit_visibility_in_menu": null, "parent": null, "publisher_state": 1, "soft_root": false, "publication_date": "2011-01-22 17:07:12", "publisher_public": null, "level": 0, "changed_by": "admin", "publisher_is_draft": true, "published": true}}, {"pk": 7, "model": "cms.page", "fields": {"rght": 3, "navigation_extenders": null, "site": 1, "creation_date": "2011-01-22 17:07:12", "lft": 2, "in_navigation": false, "reverse_id": null, "login_required": false, "created_by": "script", "publication_end_date": null, "moderator_state": 0, "template": "nav_playground.html", "tree_id": 3, "placeholders": [13, 14], "limit_visibility_in_menu": null, "parent": 6, "publisher_state": 1, "soft_root": false, "publication_date": "2011-01-22 17:07:12", "publisher_public": null, "level": 1, "changed_by": "script", "publisher_is_draft": true, "published": true}}, {"pk": 8, "model": "cms.page", "fields": {"rght": 5, "navigation_extenders": null, "site": 1, "creation_date": "2011-01-22 17:07:13", "lft": 4, "in_navigation": true, "reverse_id": null, "login_required": false, "created_by": "script", "publication_end_date": null, "moderator_state": 0, "template": "nav_playground.html", "tree_id": 3, "placeholders": [15, 16], "limit_visibility_in_menu": null, "parent": 6, "publisher_state": 1, "soft_root": false, "publication_date": "2011-01-22 17:07:13", "publisher_public": null, "level": 1, "changed_by": "script", "publisher_is_draft": true, "published": true}}, {"pk": 1, "model": "cms.title", "fields": {"menu_title": null, "redirect": null, "meta_keywords": null, "page_title": null, "language": "en", "title": "test page 1", "has_url_overwrite": false, "application_urls": null, "creation_date": "2011-01-22 17:07:09", "page": 1, "path": "test-page-1", "meta_description": null, "slug": "test-page-1"}}, {"pk": 2, "model": "cms.title", "fields": {"menu_title": null, "redirect": null, "meta_keywords": null, "page_title": null, "language": "en", "title": "test page 2", "has_url_overwrite": false, "application_urls": null, "creation_date": "2011-01-22 17:07:10", "page": 2, "path": "test-page-1/test-page-2", "meta_description": null, "slug": "test-page-2"}}, {"pk": 3, "model": "cms.title", "fields": {"menu_title": null, "redirect": null, "meta_keywords": null, "page_title": null, "language": "en", "title": "test page 3", "has_url_overwrite": false, "application_urls": null, "creation_date": "2011-01-22 17:07:10", "page": 3, "path": "test-page-1/test-page-2/test-page-3", "meta_description": null, "slug": "test-page-3"}}, {"pk": 4, "model": "cms.title", "fields": {"menu_title": null, "redirect": null, "meta_keywords": null, "page_title": null, "language": "en", "title": "test page 4", "has_url_overwrite": false, "application_urls": null, "creation_date": "2011-01-22 17:07:11", "page": 4, "path": "test-page-4", "meta_description": null, "slug": "test-page-4"}}, {"pk": 5, "model": "cms.title", "fields": {"menu_title": null, "redirect": null, "meta_keywords": null, "page_title": null, "language": "en", "title": "test page 5", "has_url_overwrite": false, "application_urls": null, "creation_date": "2011-01-22 17:07:12", "page": 5, "path": "test-page-4/test-page-5", "meta_description": null, "slug": "test-page-5"}}, {"pk": 6, "model": "cms.title", "fields": {"menu_title": "", "redirect": "", "meta_keywords": "", "page_title": "", "language": "en", "title": "test page 6", "has_url_overwrite": false, "application_urls": "", "creation_date": "2011-01-22 17:07:12", "page": 6, "path": "test-page-6", "meta_description": "", "slug": "test-page-6"}}, {"pk": 7, "model": "cms.title", "fields": {"menu_title": null, "redirect": null, "meta_keywords": null, "page_title": null, "language": "en", "title": "test page 7", "has_url_overwrite": false, "application_urls": null, "creation_date": "2011-01-22 17:07:13", "page": 7, "path": "test-page-6/test-page-7", "meta_description": null, "slug": "test-page-7"}}, {"pk": 8, "model": "cms.title", "fields": {"menu_title": null, "redirect": null, "meta_keywords": null, "page_title": null, "language": "en", "title": "test page 8", "has_url_overwrite": false, "application_urls": null, "creation_date": "2011-01-22 17:07:13", "page": 8, "path": "test-page-6/test-page-8", "meta_description": null, "slug": "test-page-8"}}]
Please sign in to comment.
Something went wrong with that request. Please try again.