Permalink
Browse files

proper assertTrue for page.moderator_state

  • Loading branch information...
1 parent ad5cdeb commit e69274fb99a13806c8dc0fb0bd3cd50eb09017bd @fivethreeo fivethreeo committed Dec 30, 2010
Showing with 2 additions and 49 deletions.
  1. +0 −47 cms/tests/base.py
  2. +2 −2 cms/tests/permmod.py
View
47 cms/tests/base.py
@@ -166,54 +166,7 @@ def create_page(self, parent_page=None, user=None, position="last-child",
del _thread_locals.user
return page
-
- def create_page(self, parent_page=None, user=None, position="last-child",
- title=None, site=1, published=False, in_navigation=False, **extra):
- """
- Common way for page creation with some checks
- """
- _thread_locals.user = user
- language = settings.LANGUAGES[0][0]
- if settings.CMS_SITE_LANGUAGES.get(site, False):
- language = settings.CMS_SITE_LANGUAGES[site][0]
- site = Site.objects.get(pk=site)
-
- page_data = {
- 'site': site,
- 'template': 'nav_playground.html',
- 'published': published,
- 'in_navigation': in_navigation,
- }
- if user:
- page_data['created_by'] = user
- page_data['changed_by'] = user
- if parent_page:
- page_data['parent'] = parent_page
- page_data.update(**extra)
- page = Page.objects.create(**page_data)
- if parent_page:
- page.move_to(parent_page, position)
- page.save()
-
- if settings.CMS_MODERATOR and user:
- page.pagemoderator_set.create(user=user)
-
- title_data = {
- 'title': 'test page %d' % self.counter,
- 'slug': 'test-page-%d' % self.counter,
- 'language': language,
- 'page': page,
- }
- self.counter = self.counter + 1
- if title:
- title_data['title'] = title
- title_data['slug'] = slugify(title)
- Title.objects.create(**title_data)
-
- del _thread_locals.user
- return page
-
def copy_page(self, page, target_page):
from cms.utils.page import get_available_slug
View
4 cms/tests/permmod.py
@@ -331,7 +331,7 @@ def test_05_slave_can_add_page_under_slave_home(self):
# moderators and approvement ok?
self.assertEqual(page.get_moderator_queryset().count(), 1)
- assert(page.moderator_state == Page.MODERATOR_NEED_APPROVEMENT)
+ self.assertTrue(page.moderator_state == Page.MODERATOR_NEED_APPROVEMENT)
# must not have public object yet
self.assertFalse(page.publisher_public)
@@ -354,7 +354,7 @@ def test_06_page_added_by_slave_can_be_published_approved_by_user_master(self):
page = self.create_page(slave_page, user=self.user_slave)
# same as test_05_slave_can_add_page_under_slave_home
self.assertEqual(page.get_moderator_queryset().count(), 1)
- assert(page.moderator_state == Page.MODERATOR_NEED_APPROVEMENT)
+ self.assertTrue(page.moderator_state == Page.MODERATOR_NEED_APPROVEMENT)
# must not have public object yet
self.assertFalse(page.publisher_public)

0 comments on commit e69274f

Please sign in to comment.