Permalink
Browse files

Fixed running test_show_toolbar_with_edit and test_show_toolbar_witho…

…ut_edit running isolated
  • Loading branch information...
1 parent 55ef6ef commit 01c067c1a5d05c0136896b10aa55d122388f402b Jonas Obrist committed Sep 8, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 cms/tests/toolbar.py
View
@@ -41,8 +41,9 @@ def get_superuser(self):
class ToolbarTests(SettingsOverrideTestCase, ToolbarUserMixin):
settings_overrides = {'CMS_MODERATOR': False}
- def setUp(self):
- self.request_factory = RequestFactory()
+ @property
+ def request_factory(self):
+ return RequestFactory()
def test_toolbar_no_page_anon(self):
request = self.request_factory.get('/')
@@ -223,6 +224,7 @@ def test_show_toolbar_with_edit(self):
created_by=superuser, published=True)
request = self.request_factory.get('%s?edit' % page.get_absolute_url())
request.current_page = page
+ request.user = AnonymousUser()
SessionMiddleware().process_request(request)
toolbar = CMSToolbar(request)
self.assertTrue(toolbar.show_toolbar)
@@ -233,6 +235,7 @@ def test_show_toolbar_without_edit(self):
created_by=superuser, published=True)
request = self.request_factory.get(page.get_absolute_url())
request.current_page = page
+ request.user = AnonymousUser()
SessionMiddleware().process_request(request)
toolbar = CMSToolbar(request)
self.assertFalse(toolbar.show_toolbar)

0 comments on commit 01c067c

Please sign in to comment.