Skip to content
Browse files

Added test to cover asking an existing page in a non-existing language

  • Loading branch information...
1 parent d5fd848 commit 99511cdddb562a7a166062efff76f89d9aed1ce6 @chrisglass chrisglass committed Jan 21, 2011
Showing with 24 additions and 0 deletions.
  1. +24 −0 cms/tests/rendering.py
View
24 cms/tests/rendering.py
@@ -11,6 +11,7 @@
from cms.plugin_rendering import render_plugins, PluginContext
from cms import plugin_rendering
from django.forms.widgets import Media
+from django.http import Http404
TEMPLATE_NAME = 'tests/rendering/base.html'
@@ -233,4 +234,27 @@ def test_09_inherit_placeholder(self):
r = self.render(t)
self.test_page = self.old_test_page
self.assertEqual(r, u'|'+self.test_data['text_main']+'|'+self.test_data3['text_sub'])
+
+ def test_10_detail_view_404_when_no_language_is_found(self):
+ with SettingsOverride(TEMPLATE_CONTEXT_PROCESSORS=[],
+ CMS_LANGUAGE_FALLBACK=True,
+ CMS_DBGETTEXT=False,
+ CMS_LANGUAGES=[( 'klingon', 'Klingon' ),
+ ( 'elvish', 'Elvish' )]):
+ from cms.views import details
+ class Mock:
+ pass
+ request = Mock()
+ setattr(request, 'REQUEST',{'language':'elvish'})
+ setattr(request, 'GET',[])
+ setattr(request, 'session',{})
+ setattr(request, 'path','')
+ setattr(request, 'user',self.user)
+ setattr(request, 'current_page',None)
+ raised = False
+ try:
+ details(request, slug=self.test_page.get_slug())
+ except Http404:
+ raised = True
+ self.assertTrue(raised)

0 comments on commit 99511cd

Please sign in to comment.
Something went wrong with that request. Please try again.