Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

better test

  • Loading branch information...
commit 8bf3fdc91db11e5f3f76957dded61eb1fa63a7b8 1 parent d5d075c
@fivethreeo fivethreeo authored
Showing with 11 additions and 7 deletions.
  1. +3 −1 cms/appresolver.py
  2. +8 −6 cms/tests/apphooks.py
View
4 cms/appresolver.py
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
from cms.apphook_pool import apphook_pool
from cms.exceptions import NoHomeFound
+from cms.utils.moderator import get_page_queryset
+
from django.conf import settings
from django.conf.urls.defaults import patterns
from django.contrib.sites.models import Site
@@ -12,13 +14,13 @@
APP_RESOLVERS = []
def clear_app_resolvers():
+ global APP_RESOLVERS
APP_RESOLVERS = []
def applications_page_check(request, current_page=None, path=None):
"""Tries to find if given path was resolved over application.
Applications have higher priority than other cms pages.
"""
- from cms.utils.moderator import get_page_queryset
if current_page:
return current_page
if path is None:
View
14 cms/tests/apphooks.py
@@ -98,8 +98,10 @@ def test_04_get_page_for_apphook(self):
child_child_page.title_set.all().update(application_urls='SampleApp')
child_child_page.publish()
+ # publisher_public is set to draft on publish, issue with onetoone reverse
+ child_child_page = self.reload(child_child_page)
- en_title = child_child_page.get_title('en')
+ en_title = child_child_page.publisher_public.get_title_obj('en')
path = reverse('en:sample-settings')
@@ -107,26 +109,26 @@ def test_04_get_page_for_apphook(self):
request.LANGUAGE_CODE = 'en'
attached_to_page = applications_page_check(request, path=path[1:]) # strip leading slash
- self.assertEquals(attached_to_page.get_title('en'), en_title)
+ self.assertEquals(attached_to_page.pk, en_title.page.pk)
response = self.client.get(path)
self.assertEquals(response.status_code, 200)
self.assertTemplateUsed(response, 'sampleapp/home.html')
- self.assertContains(response, en_title)
+ self.assertContains(response, en_title.title)
- de_title = child_child_page.get_title('de')
+ de_title = child_child_page.publisher_public.get_title_obj('de')
path = reverse('de:sample-settings')
request = self.get_request(path)
request.LANGUAGE_CODE = 'de'
attached_to_page = applications_page_check(request, path=path[4:]) # strip leading slash and language prefix
- self.assertEquals(attached_to_page.get_title('de'), de_title)
+ self.assertEquals(attached_to_page.pk, de_title.page.pk)
response = self.client.get(path)
self.assertEquals(response.status_code, 200)
self.assertTemplateUsed(response, 'sampleapp/home.html')
- self.assertContains(response, de_title)
+ self.assertContains(response, de_title.title)
apphook_pool.clear()
Please sign in to comment.
Something went wrong with that request. Please try again.