Skip to content

Commit

Permalink
Fix all the tests for Django 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Fantomas42 committed Apr 30, 2015
1 parent 45e837c commit 06542f7
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 110 deletions.
5 changes: 0 additions & 5 deletions zinnia/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from django.utils.translation import activate
from django.utils.translation import deactivate
from django.contrib.admin.sites import AdminSite
from django.test.utils import restore_template_loaders
from django.contrib.auth.tests.utils import skipIfCustomUser

from zinnia import settings
Expand Down Expand Up @@ -45,10 +44,6 @@ def tearDown(self):
self.urls = self.rich_urls
self._urlconf_setup()
deactivate()
try:
restore_template_loaders()
except AttributeError:
pass

def check_with_rich_and_poor_urls(self, func, args,
result_rich, result_poor):
Expand Down
14 changes: 5 additions & 9 deletions zinnia/tests/test_moderator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from django.utils import timezone
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.test.utils import restore_template_loaders
from django.test.utils import setup_test_template_loader
from django.test.utils import override_settings
from django.contrib.auth.tests.utils import skipIfCustomUser

import django_comments as comments
Expand All @@ -22,16 +21,16 @@


@skipIfCustomUser
@override_settings(
TEMPLATE_LOADERS=(
'zinnia.tests.utils.VoidLoader',
))
class CommentModeratorTestCase(TestCase):
"""Test cases for the moderator"""

def setUp(self):
disconnect_entry_signals()
disconnect_discussion_signals()
setup_test_template_loader(
{'comments/comment_authors_email.txt': '',
'comments/comment_notification_email.txt': '',
'comments/comment_reply_email.txt': ''})

self.site = Site.objects.get_current()
self.author = Author.objects.create(username='admin',
Expand All @@ -44,9 +43,6 @@ def setUp(self):
self.entry.sites.add(self.site)
self.entry.authors.add(self.author)

def tearDown(self):
restore_template_loaders()

def test_email(self):
comment = comments.get_model().objects.create(
comment='My Comment', user=self.author, is_public=True,
Expand Down
14 changes: 5 additions & 9 deletions zinnia/tests/test_pingback.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
from django.utils import timezone
from django.test import TestCase
from django.contrib.sites.models import Site
from django.test.utils import restore_template_loaders
from django.test.utils import setup_test_template_loader
from django.test.utils import override_settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.tests.utils import skipIfCustomUser

Expand All @@ -37,6 +36,10 @@


@skipIfCustomUser
@override_settings(
TEMPLATE_LOADERS=(
'zinnia.tests.utils.EntryDetailLoader',
))
class PingBackTestCase(TestCase):
"""Test cases for pingbacks"""
urls = 'zinnia.tests.implementations.urls.default'
Expand Down Expand Up @@ -65,12 +68,6 @@ def setUp(self):
import zinnia.xmlrpc.pingback
self.original_urlopen = zinnia.xmlrpc.pingback.urlopen
zinnia.xmlrpc.pingback.urlopen = self.fake_urlopen
# Set a short template for entry_detail to avoid rendering errors
setup_test_template_loader(
{'zinnia/entry_detail.html':
'<html><head><title>{{ object.title }}</title></head>'
'<body>{{ object.html_content|safe }}</body></html>',
'404.html': '404'})
# Preparing site
self.site = Site.objects.get_current()
# Creating tests entries
Expand Down Expand Up @@ -110,7 +107,6 @@ def tearDown(self):
import zinnia.xmlrpc.pingback
zinnia.xmlrpc.pingback.urlopen = self.original_urlopen
shortener_settings.URL_SHORTENER_BACKEND = self.original_shortener
restore_template_loaders()

def test_generate_pingback_content(self):
soup = BeautifulSoup(self.second_entry.content)
Expand Down

0 comments on commit 06542f7

Please sign in to comment.