Permalink
Browse files

test for #1296 (apphook urls breaking on home tree)

  • Loading branch information...
1 parent 0161474 commit 6fa2770c7ee20493565455d6cd4c6e893ce9819d @ojii ojii committed Jun 15, 2012
Showing with 14 additions and 1 deletion.
  1. +14 −1 cms/tests/apphooks.py
View
@@ -2,7 +2,8 @@
from __future__ import with_statement
from cms.api import create_page, create_title
from cms.apphook_pool import apphook_pool
-from cms.appresolver import applications_page_check, clear_app_resolvers
+from cms.appresolver import (applications_page_check, clear_app_resolvers,
+ get_app_patterns)
from cms.test_utils.testcases import CMSTestCase
from cms.test_utils.util.context_managers import SettingsOverride
from django.contrib.auth.models import User
@@ -135,3 +136,15 @@ def test_get_page_for_apphook(self):
self.assertContains(response, de_title.title)
apphook_pool.clear()
+
+ def test_apphook_breaking_under_home_with_new_path_caching(self):
+ with SettingsOverride(CMS_MODERATOR=False, CMS_PERMISSION=False):
+ home = create_page("home", "nav_playground.html", "en", published=True)
+ child = create_page("child", "nav_playground.html", "en", published=True, parent=home)
+ # not-home is what breaks stuff, because it contains the slug of the home page
+ not_home = create_page("not-home", "nav_playground.html", "en", published=True, parent=child)
+ create_page("subchild", "nav_playground.html", "en", published=True, parent=not_home, apphook='SampleApp')
+ urlpatterns = get_app_patterns()
+ resolver = urlpatterns[0]
+ url = resolver.reverse('sample-root')
+ self.assertEqual(url, 'child/not-home/subchild/')

0 comments on commit 6fa2770

Please sign in to comment.