Commit 9b445f268529592d4c2b9b0371218309f90edc0b
1 parent
a1c1e83d
Replaced test urls by ROOT_URLCONF override
Showing
4 changed files
with
9 additions
and
6 deletions
| @@ -16,13 +16,15 @@ from testapp.models import Article, Author | @@ -16,13 +16,15 @@ from testapp.models import Article, Author | ||
| 16 | CT = ContentType.objects.get_for_model | 16 | CT = ContentType.objects.get_for_model |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | -@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',)) | 19 | +@override_settings( |
| 20 | + PASSWORD_HASHERS=('django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',), | ||
| 21 | + ROOT_URLCONF='testapp.urls_default', | ||
| 22 | +) | ||
| 20 | class CommentTestCase(TestCase): | 23 | class CommentTestCase(TestCase): |
| 21 | """ | 24 | """ |
| 22 | Helper base class for comment tests that need data. | 25 | Helper base class for comment tests that need data. |
| 23 | """ | 26 | """ |
| 24 | fixtures = ["comment_tests"] | 27 | fixtures = ["comment_tests"] |
| 25 | - urls = 'testapp.urls_default' | ||
| 26 | 28 | ||
| 27 | def createSomeComments(self): | 29 | def createSomeComments(self): |
| 28 | # Two anonymous comments on two different objects | 30 | # Two anonymous comments on two different objects |
| @@ -50,10 +50,9 @@ class CommentAppAPITests(CommentTestCase): | @@ -50,10 +50,9 @@ class CommentAppAPITests(CommentTestCase): | ||
| 50 | 50 | ||
| 51 | 51 | ||
| 52 | @override_settings( | 52 | @override_settings( |
| 53 | - COMMENTS_APP='custom_comments', | 53 | + COMMENTS_APP='custom_comments', ROOT_URLCONF='testapp.urls', |
| 54 | ) | 54 | ) |
| 55 | class CustomCommentTest(CommentTestCase): | 55 | class CustomCommentTest(CommentTestCase): |
| 56 | - urls = 'testapp.urls' | ||
| 57 | 56 | ||
| 58 | def testGetCommentApp(self): | 57 | def testGetCommentApp(self): |
| 59 | import custom_comments | 58 | import custom_comments |
| @@ -5,6 +5,7 @@ from xml.etree import ElementTree as ET | @@ -5,6 +5,7 @@ from xml.etree import ElementTree as ET | ||
| 5 | from django.conf import settings | 5 | from django.conf import settings |
| 6 | from django.contrib.contenttypes.models import ContentType | 6 | from django.contrib.contenttypes.models import ContentType |
| 7 | from django.contrib.sites.models import Site | 7 | from django.contrib.sites.models import Site |
| 8 | +from django.test.utils import override_settings | ||
| 8 | 9 | ||
| 9 | from django_comments.models import Comment | 10 | from django_comments.models import Comment |
| 10 | 11 | ||
| @@ -12,8 +13,8 @@ from . import CommentTestCase | @@ -12,8 +13,8 @@ from . import CommentTestCase | ||
| 12 | from testapp.models import Article | 13 | from testapp.models import Article |
| 13 | 14 | ||
| 14 | 15 | ||
| 16 | +@override_settings(ROOT_URLCONF='testapp.urls') | ||
| 15 | class CommentFeedTests(CommentTestCase): | 17 | class CommentFeedTests(CommentTestCase): |
| 16 | - urls = 'testapp.urls' | ||
| 17 | feed_url = '/rss/comments/' | 18 | feed_url = '/rss/comments/' |
| 18 | 19 | ||
| 19 | def setUp(self): | 20 | def setUp(self): |
| @@ -2,6 +2,7 @@ from __future__ import absolute_import, unicode_literals | @@ -2,6 +2,7 @@ from __future__ import absolute_import, unicode_literals | ||
| 2 | 2 | ||
| 3 | from django.contrib.auth.models import User, Permission | 3 | from django.contrib.auth.models import User, Permission |
| 4 | from django.contrib.contenttypes.models import ContentType | 4 | from django.contrib.contenttypes.models import ContentType |
| 5 | +from django.test.utils import override_settings | ||
| 5 | from django.utils import translation | 6 | from django.utils import translation |
| 6 | 7 | ||
| 7 | from django_comments import signals | 8 | from django_comments import signals |
| @@ -259,8 +260,8 @@ class ApproveViewTests(CommentTestCase): | @@ -259,8 +260,8 @@ class ApproveViewTests(CommentTestCase): | ||
| 259 | self.assertTemplateUsed(response, "comments/approved.html") | 260 | self.assertTemplateUsed(response, "comments/approved.html") |
| 260 | 261 | ||
| 261 | 262 | ||
| 263 | +@override_settings(ROOT_URLCONF='testapp.urls_admin') | ||
| 262 | class AdminActionsTests(CommentTestCase): | 264 | class AdminActionsTests(CommentTestCase): |
| 263 | - urls = "testapp.urls_admin" | ||
| 264 | 265 | ||
| 265 | def setUp(self): | 266 | def setUp(self): |
| 266 | super(AdminActionsTests, self).setUp() | 267 | super(AdminActionsTests, self).setUp() |
Please
register
or
login
to post a comment