mirror of https://github.com/django/django.git
Fixed #21977 -- Deprecated SimpleTestCase.urls
This commit is contained in:
parent
d2f4553d70
commit
cd914e31c9
|
@ -66,6 +66,7 @@ class PermWrapperTests(TestCase):
|
||||||
TEMPLATE_DIRS=(
|
TEMPLATE_DIRS=(
|
||||||
os.path.join(os.path.dirname(upath(__file__)), 'templates'),
|
os.path.join(os.path.dirname(upath(__file__)), 'templates'),
|
||||||
),
|
),
|
||||||
|
ROOT_URLCONF='django.contrib.auth.tests.urls',
|
||||||
USE_TZ=False, # required for loading the fixture
|
USE_TZ=False, # required for loading the fixture
|
||||||
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
)
|
)
|
||||||
|
@ -73,7 +74,6 @@ class AuthContextProcessorTests(TestCase):
|
||||||
"""
|
"""
|
||||||
Tests for the ``django.contrib.auth.context_processors.auth`` processor
|
Tests for the ``django.contrib.auth.context_processors.auth`` processor
|
||||||
"""
|
"""
|
||||||
urls = 'django.contrib.auth.tests.urls'
|
|
||||||
fixtures = ['context-processors-users.xml']
|
fixtures = ['context-processors-users.xml']
|
||||||
|
|
||||||
@override_settings(
|
@override_settings(
|
||||||
|
|
|
@ -5,16 +5,16 @@ from django.contrib.auth.tests.test_views import AuthViewsTestCase
|
||||||
from django.contrib.auth.tests.utils import skipIfCustomUser
|
from django.contrib.auth.tests.utils import skipIfCustomUser
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
from django.test.client import RequestFactory
|
from django.test.client import RequestFactory
|
||||||
|
|
||||||
|
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.auth.tests.urls')
|
||||||
class LoginRequiredTestCase(AuthViewsTestCase):
|
class LoginRequiredTestCase(AuthViewsTestCase):
|
||||||
"""
|
"""
|
||||||
Tests the login_required decorators
|
Tests the login_required decorators
|
||||||
"""
|
"""
|
||||||
urls = 'django.contrib.auth.tests.urls'
|
|
||||||
|
|
||||||
def testCallable(self):
|
def testCallable(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -6,14 +6,14 @@ from django.contrib.auth.backends import RemoteUserBackend
|
||||||
from django.contrib.auth.middleware import RemoteUserMiddleware
|
from django.contrib.auth.middleware import RemoteUserMiddleware
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.auth.tests.utils import skipIfCustomUser
|
from django.contrib.auth.tests.utils import skipIfCustomUser
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
|
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.auth.tests.urls')
|
||||||
class RemoteUserTest(TestCase):
|
class RemoteUserTest(TestCase):
|
||||||
|
|
||||||
urls = 'django.contrib.auth.tests.urls'
|
|
||||||
middleware = 'django.contrib.auth.middleware.RemoteUserMiddleware'
|
middleware = 'django.contrib.auth.middleware.RemoteUserMiddleware'
|
||||||
backend = 'django.contrib.auth.backends.RemoteUserBackend'
|
backend = 'django.contrib.auth.backends.RemoteUserBackend'
|
||||||
header = 'REMOTE_USER'
|
header = 'REMOTE_USER'
|
||||||
|
|
|
@ -7,9 +7,10 @@ from django.test import override_settings
|
||||||
|
|
||||||
|
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
@override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(USE_TZ=False,
|
||||||
|
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='django.contrib.auth.tests.urls')
|
||||||
class SignalTestCase(TestCase):
|
class SignalTestCase(TestCase):
|
||||||
urls = 'django.contrib.auth.tests.urls'
|
|
||||||
fixtures = ['authtestdata.json']
|
fixtures = ['authtestdata.json']
|
||||||
|
|
||||||
def listener_login(self, user, **kwargs):
|
def listener_login(self, user, **kwargs):
|
||||||
|
|
|
@ -15,9 +15,9 @@ from django.utils.http import urlsafe_base64_encode
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
@override_settings(
|
@override_settings(
|
||||||
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='django.contrib.auth.tests.urls',
|
||||||
)
|
)
|
||||||
class AuthTemplateTests(TestCase):
|
class AuthTemplateTests(TestCase):
|
||||||
urls = 'django.contrib.auth.tests.urls'
|
|
||||||
|
|
||||||
def test_titles(self):
|
def test_titles(self):
|
||||||
rf = RequestFactory()
|
rf = RequestFactory()
|
||||||
|
|
|
@ -41,13 +41,13 @@ from django.contrib.auth.views import login as login_view
|
||||||
),
|
),
|
||||||
USE_TZ=False,
|
USE_TZ=False,
|
||||||
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='django.contrib.auth.tests.urls',
|
||||||
)
|
)
|
||||||
class AuthViewsTestCase(TestCase):
|
class AuthViewsTestCase(TestCase):
|
||||||
"""
|
"""
|
||||||
Helper base class for all the follow test cases.
|
Helper base class for all the follow test cases.
|
||||||
"""
|
"""
|
||||||
fixtures = ['authtestdata.json']
|
fixtures = ['authtestdata.json']
|
||||||
urls = 'django.contrib.auth.tests.urls'
|
|
||||||
|
|
||||||
def login(self, username='testclient', password='password'):
|
def login(self, username='testclient', password='password'):
|
||||||
response = self.client.post('/login/', {
|
response = self.client.post('/login/', {
|
||||||
|
@ -86,8 +86,8 @@ class AuthViewsTestCase(TestCase):
|
||||||
|
|
||||||
|
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.auth.urls')
|
||||||
class AuthViewNamedURLTests(AuthViewsTestCase):
|
class AuthViewNamedURLTests(AuthViewsTestCase):
|
||||||
urls = 'django.contrib.auth.urls'
|
|
||||||
|
|
||||||
def test_named_urls(self):
|
def test_named_urls(self):
|
||||||
"Named URLs should be reversible"
|
"Named URLs should be reversible"
|
||||||
|
@ -786,9 +786,9 @@ class LogoutTest(AuthViewsTestCase):
|
||||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware'
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware'
|
||||||
],
|
],
|
||||||
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='django.contrib.auth.tests.urls_admin',
|
||||||
)
|
)
|
||||||
class ChangelistTests(AuthViewsTestCase):
|
class ChangelistTests(AuthViewsTestCase):
|
||||||
urls = 'django.contrib.auth.tests.urls_admin'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
# Make me a superuser before logging in.
|
# Make me a superuser before logging in.
|
||||||
|
|
|
@ -15,6 +15,7 @@ from django.test import override_settings
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
||||||
),
|
),
|
||||||
|
ROOT_URLCONF='django.contrib.flatpages.tests.urls',
|
||||||
CSRF_FAILURE_VIEW='django.views.csrf.csrf_failure',
|
CSRF_FAILURE_VIEW='django.views.csrf.csrf_failure',
|
||||||
TEMPLATE_DIRS=(
|
TEMPLATE_DIRS=(
|
||||||
os.path.join(os.path.dirname(__file__), 'templates'),
|
os.path.join(os.path.dirname(__file__), 'templates'),
|
||||||
|
@ -23,7 +24,6 @@ from django.test import override_settings
|
||||||
)
|
)
|
||||||
class FlatpageCSRFTests(TestCase):
|
class FlatpageCSRFTests(TestCase):
|
||||||
fixtures = ['sample_flatpages', 'example_site']
|
fixtures = ['sample_flatpages', 'example_site']
|
||||||
urls = 'django.contrib.flatpages.tests.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.client = Client(enforce_csrf_checks=True)
|
self.client = Client(enforce_csrf_checks=True)
|
||||||
|
|
|
@ -16,6 +16,7 @@ from django.test import TestCase, override_settings
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
||||||
),
|
),
|
||||||
|
ROOT_URLCONF='django.contrib.flatpages.tests.urls',
|
||||||
TEMPLATE_DIRS=(
|
TEMPLATE_DIRS=(
|
||||||
os.path.join(os.path.dirname(__file__), 'templates'),
|
os.path.join(os.path.dirname(__file__), 'templates'),
|
||||||
),
|
),
|
||||||
|
@ -23,7 +24,6 @@ from django.test import TestCase, override_settings
|
||||||
)
|
)
|
||||||
class FlatpageMiddlewareTests(TestCase):
|
class FlatpageMiddlewareTests(TestCase):
|
||||||
fixtures = ['sample_flatpages', 'example_site']
|
fixtures = ['sample_flatpages', 'example_site']
|
||||||
urls = 'django.contrib.flatpages.tests.urls'
|
|
||||||
|
|
||||||
def test_view_flatpage(self):
|
def test_view_flatpage(self):
|
||||||
"A flatpage can be served through a view, even when the middleware is in use"
|
"A flatpage can be served through a view, even when the middleware is in use"
|
||||||
|
@ -96,6 +96,7 @@ class FlatpageMiddlewareTests(TestCase):
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
||||||
),
|
),
|
||||||
|
ROOT_URLCONF='django.contrib.flatpages.tests.urls',
|
||||||
TEMPLATE_DIRS=(
|
TEMPLATE_DIRS=(
|
||||||
os.path.join(os.path.dirname(__file__), 'templates'),
|
os.path.join(os.path.dirname(__file__), 'templates'),
|
||||||
),
|
),
|
||||||
|
@ -103,7 +104,6 @@ class FlatpageMiddlewareTests(TestCase):
|
||||||
)
|
)
|
||||||
class FlatpageMiddlewareAppendSlashTests(TestCase):
|
class FlatpageMiddlewareAppendSlashTests(TestCase):
|
||||||
fixtures = ['sample_flatpages', 'example_site']
|
fixtures = ['sample_flatpages', 'example_site']
|
||||||
urls = 'django.contrib.flatpages.tests.urls'
|
|
||||||
|
|
||||||
def test_redirect_view_flatpage(self):
|
def test_redirect_view_flatpage(self):
|
||||||
"A flatpage can be served through a view and should add a slash"
|
"A flatpage can be served through a view and should add a slash"
|
||||||
|
|
|
@ -14,6 +14,7 @@ from django.test import TestCase, override_settings
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
||||||
),
|
),
|
||||||
|
ROOT_URLCONF='django.contrib.flatpages.tests.urls',
|
||||||
TEMPLATE_DIRS=(
|
TEMPLATE_DIRS=(
|
||||||
os.path.join(os.path.dirname(__file__), 'templates'),
|
os.path.join(os.path.dirname(__file__), 'templates'),
|
||||||
),
|
),
|
||||||
|
@ -21,7 +22,6 @@ from django.test import TestCase, override_settings
|
||||||
)
|
)
|
||||||
class FlatpageTemplateTagTests(TestCase):
|
class FlatpageTemplateTagTests(TestCase):
|
||||||
fixtures = ['sample_flatpages']
|
fixtures = ['sample_flatpages']
|
||||||
urls = 'django.contrib.flatpages.tests.urls'
|
|
||||||
|
|
||||||
def test_get_flatpages_tag(self):
|
def test_get_flatpages_tag(self):
|
||||||
"The flatpage template tag retrives unregistered prefixed flatpages by default"
|
"The flatpage template tag retrives unregistered prefixed flatpages by default"
|
||||||
|
|
|
@ -16,6 +16,7 @@ from django.test import TestCase, override_settings
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
# no 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
|
# no 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
|
||||||
),
|
),
|
||||||
|
ROOT_URLCONF='django.contrib.flatpages.tests.urls',
|
||||||
TEMPLATE_DIRS=(
|
TEMPLATE_DIRS=(
|
||||||
os.path.join(os.path.dirname(__file__), 'templates'),
|
os.path.join(os.path.dirname(__file__), 'templates'),
|
||||||
),
|
),
|
||||||
|
@ -23,7 +24,6 @@ from django.test import TestCase, override_settings
|
||||||
)
|
)
|
||||||
class FlatpageViewTests(TestCase):
|
class FlatpageViewTests(TestCase):
|
||||||
fixtures = ['sample_flatpages', 'example_site']
|
fixtures = ['sample_flatpages', 'example_site']
|
||||||
urls = 'django.contrib.flatpages.tests.urls'
|
|
||||||
|
|
||||||
def test_view_flatpage(self):
|
def test_view_flatpage(self):
|
||||||
"A flatpage can be served through a view"
|
"A flatpage can be served through a view"
|
||||||
|
@ -84,6 +84,7 @@ class FlatpageViewTests(TestCase):
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
# no 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
|
# no 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
|
||||||
),
|
),
|
||||||
|
ROOT_URLCONF='django.contrib.flatpages.tests.urls',
|
||||||
TEMPLATE_DIRS=(
|
TEMPLATE_DIRS=(
|
||||||
os.path.join(os.path.dirname(__file__), 'templates'),
|
os.path.join(os.path.dirname(__file__), 'templates'),
|
||||||
),
|
),
|
||||||
|
@ -91,7 +92,6 @@ class FlatpageViewTests(TestCase):
|
||||||
)
|
)
|
||||||
class FlatpageViewAppendSlashTests(TestCase):
|
class FlatpageViewAppendSlashTests(TestCase):
|
||||||
fixtures = ['sample_flatpages', 'example_site']
|
fixtures = ['sample_flatpages', 'example_site']
|
||||||
urls = 'django.contrib.flatpages.tests.urls'
|
|
||||||
|
|
||||||
def test_redirect_view_flatpage(self):
|
def test_redirect_view_flatpage(self):
|
||||||
"A flatpage can be served through a view and should add a slash"
|
"A flatpage can be served through a view and should add a slash"
|
||||||
|
|
|
@ -36,9 +36,9 @@ class TestFormPreview(preview.FormPreview):
|
||||||
TEMPLATE_DIRS=(
|
TEMPLATE_DIRS=(
|
||||||
os.path.join(os.path.dirname(upath(__file__)), 'templates'),
|
os.path.join(os.path.dirname(upath(__file__)), 'templates'),
|
||||||
),
|
),
|
||||||
|
ROOT_URLCONF='django.contrib.formtools.tests.urls',
|
||||||
)
|
)
|
||||||
class PreviewTests(TestCase):
|
class PreviewTests(TestCase):
|
||||||
urls = 'django.contrib.formtools.tests.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(PreviewTests, self).setUp()
|
super(PreviewTests, self).setUp()
|
||||||
|
|
|
@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.http import QueryDict
|
from django.http import QueryDict
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.auth.tests.utils import skipIfCustomUser
|
from django.contrib.auth.tests.utils import skipIfCustomUser
|
||||||
|
@ -13,7 +13,6 @@ from django.contrib.formtools.tests.wizard.test_forms import get_request, Step1,
|
||||||
|
|
||||||
|
|
||||||
class NamedWizardTests(object):
|
class NamedWizardTests(object):
|
||||||
urls = 'django.contrib.formtools.tests.wizard.namedwizardtests.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.testuser, created = User.objects.get_or_create(username='testuser1')
|
self.testuser, created = User.objects.get_or_create(username='testuser1')
|
||||||
|
@ -283,6 +282,7 @@ class NamedWizardTests(object):
|
||||||
|
|
||||||
|
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.namedwizardtests.urls')
|
||||||
class NamedSessionWizardTests(NamedWizardTests, TestCase):
|
class NamedSessionWizardTests(NamedWizardTests, TestCase):
|
||||||
wizard_urlname = 'nwiz_session'
|
wizard_urlname = 'nwiz_session'
|
||||||
wizard_step_1_data = {
|
wizard_step_1_data = {
|
||||||
|
@ -315,6 +315,7 @@ class NamedSessionWizardTests(NamedWizardTests, TestCase):
|
||||||
|
|
||||||
|
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.namedwizardtests.urls')
|
||||||
class NamedCookieWizardTests(NamedWizardTests, TestCase):
|
class NamedCookieWizardTests(NamedWizardTests, TestCase):
|
||||||
wizard_urlname = 'nwiz_cookie'
|
wizard_urlname = 'nwiz_cookie'
|
||||||
wizard_step_1_data = {
|
wizard_step_1_data = {
|
||||||
|
@ -347,7 +348,6 @@ class NamedCookieWizardTests(NamedWizardTests, TestCase):
|
||||||
|
|
||||||
|
|
||||||
class NamedFormTests(object):
|
class NamedFormTests(object):
|
||||||
urls = 'django.contrib.formtools.tests.wizard.namedwizardtests.urls'
|
|
||||||
|
|
||||||
def test_revalidation(self):
|
def test_revalidation(self):
|
||||||
request = get_request()
|
request = get_request()
|
||||||
|
@ -376,12 +376,14 @@ class TestNamedUrlCookieWizardView(NamedUrlCookieWizardView):
|
||||||
|
|
||||||
|
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.namedwizardtests.urls')
|
||||||
class NamedSessionFormTests(NamedFormTests, TestCase):
|
class NamedSessionFormTests(NamedFormTests, TestCase):
|
||||||
formwizard_class = TestNamedUrlSessionWizardView
|
formwizard_class = TestNamedUrlSessionWizardView
|
||||||
wizard_urlname = 'nwiz_session'
|
wizard_urlname = 'nwiz_session'
|
||||||
|
|
||||||
|
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.namedwizardtests.urls')
|
||||||
class NamedCookieFormTests(NamedFormTests, TestCase):
|
class NamedCookieFormTests(NamedFormTests, TestCase):
|
||||||
formwizard_class = TestNamedUrlCookieWizardView
|
formwizard_class = TestNamedUrlCookieWizardView
|
||||||
wizard_urlname = 'nwiz_cookie'
|
wizard_urlname = 'nwiz_cookie'
|
||||||
|
|
|
@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
from django.test.client import RequestFactory
|
from django.test.client import RequestFactory
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
@ -24,7 +24,6 @@ PoemFormSet = forms.models.inlineformset_factory(Poet, Poem, fields="__all__")
|
||||||
|
|
||||||
|
|
||||||
class WizardTests(object):
|
class WizardTests(object):
|
||||||
urls = 'django.contrib.formtools.tests.wizard.wizardtests.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.testuser, created = User.objects.get_or_create(username='testuser1')
|
self.testuser, created = User.objects.get_or_create(username='testuser1')
|
||||||
|
@ -208,6 +207,7 @@ class WizardTests(object):
|
||||||
|
|
||||||
|
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.wizardtests.urls')
|
||||||
class SessionWizardTests(WizardTests, TestCase):
|
class SessionWizardTests(WizardTests, TestCase):
|
||||||
wizard_url = '/wiz_session/'
|
wizard_url = '/wiz_session/'
|
||||||
wizard_step_1_data = {
|
wizard_step_1_data = {
|
||||||
|
@ -240,6 +240,7 @@ class SessionWizardTests(WizardTests, TestCase):
|
||||||
|
|
||||||
|
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.wizardtests.urls')
|
||||||
class CookieWizardTests(WizardTests, TestCase):
|
class CookieWizardTests(WizardTests, TestCase):
|
||||||
wizard_url = '/wiz_cookie/'
|
wizard_url = '/wiz_cookie/'
|
||||||
wizard_step_1_data = {
|
wizard_step_1_data = {
|
||||||
|
@ -272,6 +273,7 @@ class CookieWizardTests(WizardTests, TestCase):
|
||||||
|
|
||||||
|
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.formtools.tests.wizard.wizardtests.urls')
|
||||||
class WizardTestKwargs(TestCase):
|
class WizardTestKwargs(TestCase):
|
||||||
wizard_url = '/wiz_other_template/'
|
wizard_url = '/wiz_other_template/'
|
||||||
wizard_step_1_data = {
|
wizard_step_1_data = {
|
||||||
|
@ -301,7 +303,6 @@ class WizardTestKwargs(TestCase):
|
||||||
'cookie_contact_wizard-current_step': 'form4',
|
'cookie_contact_wizard-current_step': 'form4',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
urls = 'django.contrib.formtools.tests.wizard.wizardtests.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.testuser, created = User.objects.get_or_create(username='testuser1')
|
self.testuser, created = User.objects.get_or_create(username='testuser1')
|
||||||
|
|
|
@ -4,7 +4,7 @@ from unittest import skipUnless
|
||||||
|
|
||||||
from django.contrib.gis.geos import HAS_GEOS
|
from django.contrib.gis.geos import HAS_GEOS
|
||||||
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
|
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
|
|
||||||
if HAS_GEOS and HAS_SPATIAL_DB:
|
if HAS_GEOS and HAS_SPATIAL_DB:
|
||||||
from django.contrib.gis import admin
|
from django.contrib.gis import admin
|
||||||
|
@ -14,8 +14,8 @@ if HAS_GEOS and HAS_SPATIAL_DB:
|
||||||
|
|
||||||
|
|
||||||
@skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.")
|
@skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.")
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.gis.tests.geoadmin.urls')
|
||||||
class GeoAdminTest(TestCase):
|
class GeoAdminTest(TestCase):
|
||||||
urls = 'django.contrib.gis.tests.geoadmin.urls'
|
|
||||||
|
|
||||||
def test_ensure_geographic_media(self):
|
def test_ensure_geographic_media(self):
|
||||||
geoadmin = admin.site._registry[City]
|
geoadmin = admin.site._registry[City]
|
||||||
|
|
|
@ -7,18 +7,17 @@ from django.conf import settings
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.contrib.gis.geos import HAS_GEOS
|
from django.contrib.gis.geos import HAS_GEOS
|
||||||
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
|
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
|
||||||
from django.test import TestCase, modify_settings
|
from django.test import TestCase, modify_settings, override_settings
|
||||||
|
|
||||||
if HAS_GEOS:
|
if HAS_GEOS:
|
||||||
from .models import City
|
from .models import City
|
||||||
|
|
||||||
|
|
||||||
@modify_settings(INSTALLED_APPS={'append': 'django.contrib.sites'})
|
@modify_settings(INSTALLED_APPS={'append': 'django.contrib.sites'})
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.gis.tests.geoapp.urls')
|
||||||
@skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.")
|
@skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.")
|
||||||
class GeoFeedTest(TestCase):
|
class GeoFeedTest(TestCase):
|
||||||
|
|
||||||
urls = 'django.contrib.gis.tests.geoapp.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
Site(id=settings.SITE_ID, domain="example.com", name="example.com").save()
|
Site(id=settings.SITE_ID, domain="example.com", name="example.com").save()
|
||||||
|
|
||||||
|
|
|
@ -9,18 +9,17 @@ from django.conf import settings
|
||||||
from django.contrib.gis.geos import HAS_GEOS
|
from django.contrib.gis.geos import HAS_GEOS
|
||||||
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
|
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.test import TestCase, modify_settings
|
from django.test import TestCase, modify_settings, override_settings
|
||||||
|
|
||||||
if HAS_GEOS:
|
if HAS_GEOS:
|
||||||
from .models import City, Country
|
from .models import City, Country
|
||||||
|
|
||||||
|
|
||||||
@modify_settings(INSTALLED_APPS={'append': ['django.contrib.sites', 'django.contrib.sitemaps']})
|
@modify_settings(INSTALLED_APPS={'append': ['django.contrib.sites', 'django.contrib.sitemaps']})
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.gis.tests.geoapp.urls')
|
||||||
@skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.")
|
@skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.")
|
||||||
class GeoSitemapTest(TestCase):
|
class GeoSitemapTest(TestCase):
|
||||||
|
|
||||||
urls = 'django.contrib.gis.tests.geoapp.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(GeoSitemapTest, self).setUp()
|
super(GeoSitemapTest, self).setUp()
|
||||||
Site(id=settings.SITE_ID, domain="example.com", name="example.com").save()
|
Site(id=settings.SITE_ID, domain="example.com", name="example.com").save()
|
||||||
|
|
|
@ -48,7 +48,6 @@ class override_settings_tags(override_settings):
|
||||||
|
|
||||||
class BaseTests(object):
|
class BaseTests(object):
|
||||||
storage_class = default_storage
|
storage_class = default_storage
|
||||||
urls = 'django.contrib.messages.tests.urls'
|
|
||||||
levels = {
|
levels = {
|
||||||
'debug': constants.DEBUG,
|
'debug': constants.DEBUG,
|
||||||
'info': constants.INFO,
|
'info': constants.INFO,
|
||||||
|
@ -61,6 +60,7 @@ class BaseTests(object):
|
||||||
self.settings_override = override_settings_tags(
|
self.settings_override = override_settings_tags(
|
||||||
TEMPLATE_DIRS=(),
|
TEMPLATE_DIRS=(),
|
||||||
TEMPLATE_CONTEXT_PROCESSORS=global_settings.TEMPLATE_CONTEXT_PROCESSORS,
|
TEMPLATE_CONTEXT_PROCESSORS=global_settings.TEMPLATE_CONTEXT_PROCESSORS,
|
||||||
|
ROOT_URLCONF='django.contrib.messages.tests.urls',
|
||||||
MESSAGE_TAGS='',
|
MESSAGE_TAGS='',
|
||||||
MESSAGE_STORAGE='%s.%s' % (self.storage_class.__module__,
|
MESSAGE_STORAGE='%s.%s' % (self.storage_class.__module__,
|
||||||
self.storage_class.__name__),
|
self.storage_class.__name__),
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
from django.contrib.messages.tests.urls import ContactFormViewWithMsg
|
from django.contrib.messages.tests.urls import ContactFormViewWithMsg
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.messages.tests.urls')
|
||||||
class SuccessMessageMixinTests(TestCase):
|
class SuccessMessageMixinTests(TestCase):
|
||||||
urls = 'django.contrib.messages.tests.urls'
|
|
||||||
|
|
||||||
def test_set_messages_success(self):
|
def test_set_messages_success(self):
|
||||||
author = {'name': 'John Doe',
|
author = {'name': 'John Doe',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
|
|
||||||
|
|
||||||
class TestModel(models.Model):
|
class TestModel(models.Model):
|
||||||
|
@ -17,11 +17,11 @@ class TestModel(models.Model):
|
||||||
return '/testmodel/%s/' % self.id
|
return '/testmodel/%s/' % self.id
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.sitemaps.tests.urls.http')
|
||||||
class SitemapTestsBase(TestCase):
|
class SitemapTestsBase(TestCase):
|
||||||
protocol = 'http'
|
protocol = 'http'
|
||||||
sites_installed = apps.is_installed('django.contrib.sites')
|
sites_installed = apps.is_installed('django.contrib.sites')
|
||||||
domain = 'example.com' if sites_installed else 'testserver'
|
domain = 'example.com' if sites_installed else 'testserver'
|
||||||
urls = 'django.contrib.sitemaps.tests.urls.http'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.base_url = '%s://%s' % (self.protocol, self.domain)
|
self.base_url = '%s://%s' % (self.protocol, self.domain)
|
||||||
|
|
|
@ -7,9 +7,9 @@ from django.test import override_settings
|
||||||
from .base import SitemapTestsBase
|
from .base import SitemapTestsBase
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='django.contrib.sitemaps.tests.urls.https')
|
||||||
class HTTPSSitemapTests(SitemapTestsBase):
|
class HTTPSSitemapTests(SitemapTestsBase):
|
||||||
protocol = 'https'
|
protocol = 'https'
|
||||||
urls = 'django.contrib.sitemaps.tests.urls.https'
|
|
||||||
|
|
||||||
def test_secure_sitemap_index(self):
|
def test_secure_sitemap_index(self):
|
||||||
"A secure sitemap index can be rendered"
|
"A secure sitemap index can be rendered"
|
||||||
|
|
|
@ -12,6 +12,7 @@ import socket
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import unittest
|
import unittest
|
||||||
|
import warnings
|
||||||
from unittest import skipIf # NOQA: Imported here for backward compatibility
|
from unittest import skipIf # NOQA: Imported here for backward compatibility
|
||||||
from unittest.util import safe_repr
|
from unittest.util import safe_repr
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ from django.test.html import HTMLParseError, parse_html
|
||||||
from django.test.signals import setting_changed, template_rendered
|
from django.test.signals import setting_changed, template_rendered
|
||||||
from django.test.utils import (CaptureQueriesContext, ContextList,
|
from django.test.utils import (CaptureQueriesContext, ContextList,
|
||||||
override_settings, modify_settings, compare_xml)
|
override_settings, modify_settings, compare_xml)
|
||||||
|
from django.utils.deprecation import RemovedInDjango20Warning
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.utils.six.moves.urllib.parse import urlsplit, urlunsplit, urlparse, unquote
|
from django.utils.six.moves.urllib.parse import urlsplit, urlunsplit, urlparse, unquote
|
||||||
|
@ -202,6 +204,11 @@ class SimpleTestCase(unittest.TestCase):
|
||||||
def _urlconf_setup(self):
|
def _urlconf_setup(self):
|
||||||
set_urlconf(None)
|
set_urlconf(None)
|
||||||
if hasattr(self, 'urls'):
|
if hasattr(self, 'urls'):
|
||||||
|
warnings.warn(
|
||||||
|
"SimpleTestCase.urls is deprecated and will be removed in "
|
||||||
|
"Django 2.0. Use @override_settings(ROOT_URLCONF=...) "
|
||||||
|
"in %s instead." % self.__class__.__name__,
|
||||||
|
RemovedInDjango20Warning, stacklevel=2)
|
||||||
self._old_root_urlconf = settings.ROOT_URLCONF
|
self._old_root_urlconf = settings.ROOT_URLCONF
|
||||||
settings.ROOT_URLCONF = self.urls
|
settings.ROOT_URLCONF = self.urls
|
||||||
clear_url_caches()
|
clear_url_caches()
|
||||||
|
|
|
@ -20,6 +20,8 @@ about each item can often be found in the release notes of two versions prior.
|
||||||
* Support for the ``prefix`` argument to
|
* Support for the ``prefix`` argument to
|
||||||
``django.conf.urls.i18n.i18n_patterns()`` will be removed.
|
``django.conf.urls.i18n.i18n_patterns()`` will be removed.
|
||||||
|
|
||||||
|
* ``SimpleTestCase.urls`` will be removed.
|
||||||
|
|
||||||
.. _deprecation-removed-in-1.9:
|
.. _deprecation-removed-in-1.9:
|
||||||
|
|
||||||
1.9
|
1.9
|
||||||
|
|
|
@ -256,6 +256,14 @@ Updating your code is as simple as ensuring that ``urlpatterns`` is a list of
|
||||||
url('^other/$', views.otherview),
|
url('^other/$', views.otherview),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
``django.test.SimpleTestCase.urls``
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
The attribute :attr:`SimpleTestCase.urls <django.test.SimpleTestCase.urls>`
|
||||||
|
for specifying URLconf configuration in tests has been deprecated and will be
|
||||||
|
removed in Django 2.0. Use :func:`@override_settings(ROOT_URLCONF=...)
|
||||||
|
<django.test.override_settings>` instead.
|
||||||
|
|
||||||
``prefix`` argument to :func:`~django.conf.urls.i18n.i18n_patterns`
|
``prefix`` argument to :func:`~django.conf.urls.i18n.i18n_patterns`
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
|
@ -961,6 +961,11 @@ URLconf configuration
|
||||||
|
|
||||||
.. attribute:: SimpleTestCase.urls
|
.. attribute:: SimpleTestCase.urls
|
||||||
|
|
||||||
|
.. deprecated:: 1.8
|
||||||
|
|
||||||
|
Use ``@override_settings(ROOT_URLCONF=...)`` instead for URLconf
|
||||||
|
configuration.
|
||||||
|
|
||||||
If your application provides views, you may want to include tests that use the
|
If your application provides views, you may want to include tests that use the
|
||||||
test client to exercise those views. However, an end user is free to deploy the
|
test client to exercise those views. However, an end user is free to deploy the
|
||||||
views in your application at any URL of their choosing. This means that your
|
views in your application at any URL of their choosing. This means that your
|
||||||
|
|
|
@ -26,8 +26,8 @@ from .models import (Event, Child, Parent, Genre, Band, Musician, Group,
|
||||||
UnorderedObject, OrderedObject, CustomIdUser)
|
UnorderedObject, OrderedObject, CustomIdUser)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF="admin_changelist.urls")
|
||||||
class ChangeListTests(TestCase):
|
class ChangeListTests(TestCase):
|
||||||
urls = "admin_changelist.urls"
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.factory = RequestFactory()
|
self.factory = RequestFactory()
|
||||||
|
@ -664,12 +664,12 @@ class AdminLogNodeTestCase(TestCase):
|
||||||
self.assertEqual(template.render(context), '')
|
self.assertEqual(template.render(context), '')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_changelist.urls")
|
||||||
class SeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
class SeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
||||||
|
|
||||||
available_apps = ['admin_changelist'] + AdminSeleniumWebDriverTestCase.available_apps
|
available_apps = ['admin_changelist'] + AdminSeleniumWebDriverTestCase.available_apps
|
||||||
fixtures = ['users.json']
|
fixtures = ['users.json']
|
||||||
urls = "admin_changelist.urls"
|
|
||||||
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
||||||
|
|
||||||
def test_add_row_selection(self):
|
def test_add_row_selection(self):
|
||||||
|
|
|
@ -8,7 +8,8 @@ from django.test import TestCase, override_settings
|
||||||
from .models import Action, Person, Car
|
from .models import Action, Person, Car
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='admin_custom_urls.urls',)
|
||||||
class AdminCustomUrlsTest(TestCase):
|
class AdminCustomUrlsTest(TestCase):
|
||||||
"""
|
"""
|
||||||
Remember that:
|
Remember that:
|
||||||
|
@ -16,7 +17,6 @@ class AdminCustomUrlsTest(TestCase):
|
||||||
* The ModelAdmin for Action customizes the add_view URL, it's
|
* The ModelAdmin for Action customizes the add_view URL, it's
|
||||||
'<app name>/<model name>/!add/'
|
'<app name>/<model name>/!add/'
|
||||||
"""
|
"""
|
||||||
urls = 'admin_custom_urls.urls'
|
|
||||||
fixtures = ['users.json', 'actions.json']
|
fixtures = ['users.json', 'actions.json']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -83,9 +83,9 @@ class AdminCustomUrlsTest(TestCase):
|
||||||
self.assertContains(response, 'value="path/to/html/document.html"')
|
self.assertContains(response, 'value="path/to/html/document.html"')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='admin_custom_urls.urls',)
|
||||||
class CustomRedirects(TestCase):
|
class CustomRedirects(TestCase):
|
||||||
urls = 'admin_custom_urls.urls'
|
|
||||||
fixtures = ['users.json', 'actions.json']
|
fixtures = ['users.json', 'actions.json']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
|
@ -11,8 +11,8 @@ from django.test import TestCase, modify_settings, override_settings
|
||||||
from .models import Person, Company
|
from .models import Person, Company
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='admin_docs.urls')
|
||||||
class MiscTests(TestCase):
|
class MiscTests(TestCase):
|
||||||
urls = 'admin_docs.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
User.objects.create_superuser('super', None, 'secret')
|
User.objects.create_superuser('super', None, 'secret')
|
||||||
|
@ -30,11 +30,11 @@ class MiscTests(TestCase):
|
||||||
self.client.get('/admindocs/views/') # should not raise
|
self.client.get('/admindocs/views/') # should not raise
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='admin_docs.urls')
|
||||||
@unittest.skipUnless(utils.docutils_is_available, "no docutils installed.")
|
@unittest.skipUnless(utils.docutils_is_available, "no docutils installed.")
|
||||||
class AdminDocViewTests(TestCase):
|
class AdminDocViewTests(TestCase):
|
||||||
fixtures = ['data.xml']
|
fixtures = ['data.xml']
|
||||||
urls = 'admin_docs.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.client.login(username='super', password='secret')
|
self.client.login(username='super', password='secret')
|
||||||
|
@ -104,10 +104,10 @@ class AdminDocViewTests(TestCase):
|
||||||
utils.docutils_is_available = True
|
utils.docutils_is_available = True
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='admin_docs.urls')
|
||||||
class XViewMiddlewareTest(TestCase):
|
class XViewMiddlewareTest(TestCase):
|
||||||
fixtures = ['data.xml']
|
fixtures = ['data.xml']
|
||||||
urls = 'admin_docs.urls'
|
|
||||||
|
|
||||||
def test_xview_func(self):
|
def test_xview_func(self):
|
||||||
user = User.objects.get(username='super')
|
user = User.objects.get(username='super')
|
||||||
|
@ -147,8 +147,8 @@ class XViewMiddlewareTest(TestCase):
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(utils.docutils_is_available, "no docutils installed.")
|
@unittest.skipUnless(utils.docutils_is_available, "no docutils installed.")
|
||||||
|
@override_settings(ROOT_URLCONF='admin_docs.urls')
|
||||||
class DefaultRoleTest(TestCase):
|
class DefaultRoleTest(TestCase):
|
||||||
urls = 'admin_docs.urls'
|
|
||||||
|
|
||||||
def test_parse_rst(self):
|
def test_parse_rst(self):
|
||||||
"""
|
"""
|
||||||
|
@ -183,7 +183,8 @@ class DefaultRoleTest(TestCase):
|
||||||
self.assertEqual(parts['fragment'], markup)
|
self.assertEqual(parts['fragment'], markup)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='admin_docs.urls')
|
||||||
@unittest.skipUnless(utils.docutils_is_available, "no docutils installed.")
|
@unittest.skipUnless(utils.docutils_is_available, "no docutils installed.")
|
||||||
class TestModelDetailView(TestCase):
|
class TestModelDetailView(TestCase):
|
||||||
"""
|
"""
|
||||||
|
@ -191,7 +192,6 @@ class TestModelDetailView(TestCase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
fixtures = ['data.xml']
|
fixtures = ['data.xml']
|
||||||
urls = 'admin_docs.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.client.login(username='super', password='secret')
|
self.client.login(username='super', password='secret')
|
||||||
|
|
|
@ -15,9 +15,9 @@ from .models import (Holder, Inner, Holder2, Inner2, Holder3, Inner3, Person,
|
||||||
SomeChildModel)
|
SomeChildModel)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_inlines.urls")
|
||||||
class TestInline(TestCase):
|
class TestInline(TestCase):
|
||||||
urls = "admin_inlines.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -255,9 +255,9 @@ class TestInline(TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_inlines.urls")
|
||||||
class TestInlineMedia(TestCase):
|
class TestInlineMedia(TestCase):
|
||||||
urls = "admin_inlines.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -294,8 +294,8 @@ class TestInlineMedia(TestCase):
|
||||||
self.assertContains(response, 'my_awesome_inline_scripts.js')
|
self.assertContains(response, 'my_awesome_inline_scripts.js')
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF="admin_inlines.urls")
|
||||||
class TestInlineAdminForm(TestCase):
|
class TestInlineAdminForm(TestCase):
|
||||||
urls = "admin_inlines.urls"
|
|
||||||
|
|
||||||
def test_immutable_content_type(self):
|
def test_immutable_content_type(self):
|
||||||
"""Regression for #9362
|
"""Regression for #9362
|
||||||
|
@ -313,9 +313,9 @@ class TestInlineAdminForm(TestCase):
|
||||||
self.assertEqual(iaf.original.content_type, parent_ct)
|
self.assertEqual(iaf.original.content_type, parent_ct)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_inlines.urls")
|
||||||
class TestInlineProtectedOnDelete(TestCase):
|
class TestInlineProtectedOnDelete(TestCase):
|
||||||
urls = "admin_inlines.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -350,13 +350,13 @@ class TestInlineProtectedOnDelete(TestCase):
|
||||||
% (chapter, foot_note))
|
% (chapter, foot_note))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF="admin_inlines.urls")
|
||||||
class TestInlinePermissions(TestCase):
|
class TestInlinePermissions(TestCase):
|
||||||
"""
|
"""
|
||||||
Make sure the admin respects permissions for objects that are edited
|
Make sure the admin respects permissions for objects that are edited
|
||||||
inline. Refs #8060.
|
inline. Refs #8060.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
urls = "admin_inlines.urls"
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.user = User(username='admin')
|
self.user = User(username='admin')
|
||||||
|
@ -546,12 +546,12 @@ class TestInlinePermissions(TestCase):
|
||||||
self.assertContains(response, 'id="id_inner2_set-0-DELETE"')
|
self.assertContains(response, 'id="id_inner2_set-0-DELETE"')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_inlines.urls")
|
||||||
class SeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
class SeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
||||||
|
|
||||||
available_apps = ['admin_inlines'] + AdminSeleniumWebDriverTestCase.available_apps
|
available_apps = ['admin_inlines'] + AdminSeleniumWebDriverTestCase.available_apps
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
urls = "admin_inlines.urls"
|
|
||||||
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
||||||
|
|
||||||
def test_add_stackeds(self):
|
def test_add_stackeds(self):
|
||||||
|
|
|
@ -26,7 +26,7 @@ from django.db import connection
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
from django.utils._os import npath, upath
|
from django.utils._os import npath, upath
|
||||||
from django.utils.six import StringIO
|
from django.utils.six import StringIO
|
||||||
from django.test import LiveServerTestCase, TestCase
|
from django.test import LiveServerTestCase, TestCase, override_settings
|
||||||
from django.test.runner import DiscoverRunner
|
from django.test.runner import DiscoverRunner
|
||||||
from django.test.utils import str_prefix
|
from django.test.utils import str_prefix
|
||||||
|
|
||||||
|
@ -1631,9 +1631,9 @@ class ArgumentOrder(AdminScriptTestCase):
|
||||||
self.assertOutput(out, str_prefix("EXECUTE:BaseCommand labels=('testlabel',), options=[('no_color', False), ('option_a', 'x'), ('option_b', %%s), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None), ('verbosity', %(_)s'1')]") % option_b)
|
self.assertOutput(out, str_prefix("EXECUTE:BaseCommand labels=('testlabel',), options=[('no_color', False), ('option_a', 'x'), ('option_b', %%s), ('option_c', '3'), ('pythonpath', None), ('settings', 'alternate_settings'), ('traceback', None), ('verbosity', %(_)s'1')]") % option_b)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='admin_scripts.urls')
|
||||||
class StartProject(LiveServerTestCase, AdminScriptTestCase):
|
class StartProject(LiveServerTestCase, AdminScriptTestCase):
|
||||||
|
|
||||||
urls = 'admin_scripts.urls'
|
|
||||||
available_apps = [
|
available_apps = [
|
||||||
'admin_scripts',
|
'admin_scripts',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
|
|
|
@ -64,6 +64,7 @@ ADMIN_VIEW_TEMPLATES_DIR = settings.TEMPLATE_DIRS + (os.path.join(os.path.dirnam
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls",
|
||||||
USE_I18N=True, USE_L10N=False, LANGUAGE_CODE='en')
|
USE_I18N=True, USE_L10N=False, LANGUAGE_CODE='en')
|
||||||
class AdminViewBasicTestCase(TestCase):
|
class AdminViewBasicTestCase(TestCase):
|
||||||
fixtures = ['admin-views-users.xml', 'admin-views-colors.xml',
|
fixtures = ['admin-views-users.xml', 'admin-views-colors.xml',
|
||||||
|
@ -74,8 +75,6 @@ class AdminViewBasicTestCase(TestCase):
|
||||||
# this test case and changing urlbit.
|
# this test case and changing urlbit.
|
||||||
urlbit = 'admin'
|
urlbit = 'admin'
|
||||||
|
|
||||||
urls = "admin_views.urls"
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.client.login(username='super', password='secret')
|
self.client.login(username='super', password='secret')
|
||||||
|
|
||||||
|
@ -747,9 +746,9 @@ class AdminCustomTemplateTests(AdminViewBasicTestCase):
|
||||||
self.assertTemplateUsed(response, 'custom_filter_template.html')
|
self.assertTemplateUsed(response, 'custom_filter_template.html')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminViewFormUrlTest(TestCase):
|
class AdminViewFormUrlTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ["admin-views-users.xml"]
|
fixtures = ["admin-views-users.xml"]
|
||||||
urlbit = "admin3"
|
urlbit = "admin3"
|
||||||
|
|
||||||
|
@ -781,12 +780,11 @@ class AdminViewFormUrlTest(TestCase):
|
||||||
self.assertContains(response, 'value="overridden_value"')
|
self.assertContains(response, 'value="overridden_value"')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminJavaScriptTest(TestCase):
|
class AdminJavaScriptTest(TestCase):
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
urls = "admin_views.urls"
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.client.login(username='super', password='secret')
|
self.client.login(username='super', password='secret')
|
||||||
|
|
||||||
|
@ -827,9 +825,9 @@ class AdminJavaScriptTest(TestCase):
|
||||||
self.assertNotContains(response, 'inlines.min.js')
|
self.assertNotContains(response, 'inlines.min.js')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class SaveAsTests(TestCase):
|
class SaveAsTests(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml', 'admin-views-person.xml']
|
fixtures = ['admin-views-users.xml', 'admin-views-person.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -858,8 +856,8 @@ class SaveAsTests(TestCase):
|
||||||
self.assertEqual(response.context['form_url'], '/test_admin/admin/admin_views/person/add/')
|
self.assertEqual(response.context['form_url'], '/test_admin/admin/admin_views/person/add/')
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF="admin_views.urls")
|
||||||
class CustomModelAdminTest(AdminViewBasicTestCase):
|
class CustomModelAdminTest(AdminViewBasicTestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
urlbit = "admin2"
|
urlbit = "admin2"
|
||||||
|
|
||||||
def testCustomAdminSiteLoginForm(self):
|
def testCustomAdminSiteLoginForm(self):
|
||||||
|
@ -937,11 +935,11 @@ def get_perm(Model, perm):
|
||||||
return Permission.objects.get(content_type=ct, codename=perm)
|
return Permission.objects.get(content_type=ct, codename=perm)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminViewPermissionsTest(TestCase):
|
class AdminViewPermissionsTest(TestCase):
|
||||||
"""Tests for Admin Views Permissions."""
|
"""Tests for Admin Views Permissions."""
|
||||||
|
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -1465,11 +1463,11 @@ class AdminViewPermissionsTest(TestCase):
|
||||||
self.assertEqual(response.url, 'http://example.com/dummy/foo/')
|
self.assertEqual(response.url, 'http://example.com/dummy/foo/')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminViewsNoUrlTest(TestCase):
|
class AdminViewsNoUrlTest(TestCase):
|
||||||
"""Regression test for #17333"""
|
"""Regression test for #17333"""
|
||||||
|
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -1496,9 +1494,9 @@ class AdminViewsNoUrlTest(TestCase):
|
||||||
self.client.get('/test_admin/admin/logout/')
|
self.client.get('/test_admin/admin/logout/')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminViewDeletedObjectsTest(TestCase):
|
class AdminViewDeletedObjectsTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml', 'deleted-objects.xml']
|
fixtures = ['admin-views-users.xml', 'deleted-objects.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -1614,9 +1612,9 @@ class AdminViewDeletedObjectsTest(TestCase):
|
||||||
self.assertContains(response, should_contain)
|
self.assertContains(response, should_contain)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminViewStringPrimaryKeyTest(TestCase):
|
class AdminViewStringPrimaryKeyTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml', 'string-primary-key.xml']
|
fixtures = ['admin-views-users.xml', 'string-primary-key.xml']
|
||||||
|
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
|
@ -1748,12 +1746,12 @@ class AdminViewStringPrimaryKeyTest(TestCase):
|
||||||
self.assertContains(response, '<a href="%s" class="historylink"' % expected_link)
|
self.assertContains(response, '<a href="%s" class="historylink"' % expected_link)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class SecureViewTests(TestCase):
|
class SecureViewTests(TestCase):
|
||||||
"""
|
"""
|
||||||
Test behavior of a view protected by the staff_member_required decorator.
|
Test behavior of a view protected by the staff_member_required decorator.
|
||||||
"""
|
"""
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
@ -1771,9 +1769,9 @@ class SecureViewTests(TestCase):
|
||||||
self.assertEqual(response.context[REDIRECT_FIELD_NAME], secure_url)
|
self.assertEqual(response.context[REDIRECT_FIELD_NAME], secure_url)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminViewUnicodeTest(TestCase):
|
class AdminViewUnicodeTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-unicode.xml']
|
fixtures = ['admin-views-unicode.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -1826,9 +1824,9 @@ class AdminViewUnicodeTest(TestCase):
|
||||||
self.assertRedirects(response, '/test_admin/admin/admin_views/book/')
|
self.assertRedirects(response, '/test_admin/admin/admin_views/book/')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminViewListEditable(TestCase):
|
class AdminViewListEditable(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml', 'admin-views-person.xml']
|
fixtures = ['admin-views-users.xml', 'admin-views-person.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -2203,9 +2201,9 @@ class AdminViewListEditable(TestCase):
|
||||||
self.assertContains(response, '<th class="field-id"><a href="%s">%d</a></th>' % (link2, story2.id), 1)
|
self.assertContains(response, '<th class="field-id"><a href="%s">%d</a></th>' % (link2, story2.id), 1)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminSearchTest(TestCase):
|
class AdminSearchTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users', 'multiple-child-classes',
|
fixtures = ['admin-views-users', 'multiple-child-classes',
|
||||||
'admin-views-person']
|
'admin-views-person']
|
||||||
|
|
||||||
|
@ -2274,9 +2272,9 @@ class AdminSearchTest(TestCase):
|
||||||
html=True)
|
html=True)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminInheritedInlinesTest(TestCase):
|
class AdminInheritedInlinesTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -2362,9 +2360,9 @@ class AdminInheritedInlinesTest(TestCase):
|
||||||
self.assertEqual(Persona.objects.all()[0].accounts.count(), 2)
|
self.assertEqual(Persona.objects.all()[0].accounts.count(), 2)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminActionsTest(TestCase):
|
class AdminActionsTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml', 'admin-views-actions.xml']
|
fixtures = ['admin-views-users.xml', 'admin-views-actions.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -2631,9 +2629,9 @@ action)</option>
|
||||||
self.assertEqual(response.template_name, 'admin/popup_response.html')
|
self.assertEqual(response.template_name, 'admin/popup_response.html')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class TestCustomChangeList(TestCase):
|
class TestCustomChangeList(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
urlbit = 'admin'
|
urlbit = 'admin'
|
||||||
|
|
||||||
|
@ -2660,9 +2658,9 @@ class TestCustomChangeList(TestCase):
|
||||||
self.assertNotContains(response, 'First Gadget')
|
self.assertNotContains(response, 'First Gadget')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class TestInlineNotEditable(TestCase):
|
class TestInlineNotEditable(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -2680,9 +2678,9 @@ class TestInlineNotEditable(TestCase):
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminCustomQuerysetTest(TestCase):
|
class AdminCustomQuerysetTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -2925,9 +2923,9 @@ class AdminCustomQuerysetTest(TestCase):
|
||||||
self.assertEqual(self.client.get('/test_admin/admin/admin_views/filteredmanager/2/history/').status_code, 200)
|
self.assertEqual(self.client.get('/test_admin/admin/admin_views/filteredmanager/2/history/').status_code, 200)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminInlineFileUploadTest(TestCase):
|
class AdminInlineFileUploadTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml', 'admin-views-actions.xml']
|
fixtures = ['admin-views-users.xml', 'admin-views-actions.xml']
|
||||||
urlbit = 'admin'
|
urlbit = 'admin'
|
||||||
|
|
||||||
|
@ -2972,9 +2970,9 @@ class AdminInlineFileUploadTest(TestCase):
|
||||||
self.assertContains(response, b"Currently")
|
self.assertContains(response, b"Currently")
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminInlineTests(TestCase):
|
class AdminInlineTests(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -3291,9 +3289,9 @@ class AdminInlineTests(TestCase):
|
||||||
self.assertEqual(Category.objects.get(id=4).order, 0)
|
self.assertEqual(Category.objects.get(id=4).order, 0)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class NeverCacheTests(TestCase):
|
class NeverCacheTests(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml', 'admin-views-colors.xml', 'admin-views-fabrics.xml']
|
fixtures = ['admin-views-users.xml', 'admin-views-colors.xml', 'admin-views-fabrics.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -3365,9 +3363,9 @@ class NeverCacheTests(TestCase):
|
||||||
self.assertEqual(get_max_age(response), None)
|
self.assertEqual(get_max_age(response), None)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class PrePopulatedTest(TestCase):
|
class PrePopulatedTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -3401,12 +3399,12 @@ class PrePopulatedTest(TestCase):
|
||||||
self.assertContains(response, "maxLength: 1000") # instead of 1,000
|
self.assertContains(response, "maxLength: 1000") # instead of 1,000
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
|
class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
|
||||||
|
|
||||||
available_apps = ['admin_views'] + AdminSeleniumWebDriverTestCase.available_apps
|
available_apps = ['admin_views'] + AdminSeleniumWebDriverTestCase.available_apps
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
urls = "admin_views.urls"
|
|
||||||
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
||||||
|
|
||||||
def test_prepopulated_fields(self):
|
def test_prepopulated_fields(self):
|
||||||
|
@ -3597,9 +3595,9 @@ class SeleniumAdminViewsIETests(SeleniumAdminViewsFirefoxTests):
|
||||||
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class ReadonlyTest(TestCase):
|
class ReadonlyTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -3708,9 +3706,9 @@ class ReadonlyTest(TestCase):
|
||||||
self.assertNotContains(response, "Some help text for the date (with unicode ŠĐĆŽćžšđ)")
|
self.assertNotContains(response, "Some help text for the date (with unicode ŠĐĆŽćžšđ)")
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class LimitChoicesToInAdminTest(TestCase):
|
class LimitChoicesToInAdminTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -3735,9 +3733,9 @@ class LimitChoicesToInAdminTest(TestCase):
|
||||||
self.assertNotContains(response, marley.username)
|
self.assertNotContains(response, marley.username)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class RawIdFieldsTest(TestCase):
|
class RawIdFieldsTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -3815,12 +3813,12 @@ class RawIdFieldsTest(TestCase):
|
||||||
self.assertContains(response2, "Palin")
|
self.assertContains(response2, "Palin")
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class UserAdminTest(TestCase):
|
class UserAdminTest(TestCase):
|
||||||
"""
|
"""
|
||||||
Tests user CRUD functionality.
|
Tests user CRUD functionality.
|
||||||
"""
|
"""
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -3922,12 +3920,12 @@ class UserAdminTest(TestCase):
|
||||||
self.assertEqual(response.context['form_url'], 'pony')
|
self.assertEqual(response.context['form_url'], 'pony')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class GroupAdminTest(TestCase):
|
class GroupAdminTest(TestCase):
|
||||||
"""
|
"""
|
||||||
Tests group CRUD functionality.
|
Tests group CRUD functionality.
|
||||||
"""
|
"""
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -3959,9 +3957,9 @@ class GroupAdminTest(TestCase):
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class CSSTest(TestCase):
|
class CSSTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -4084,9 +4082,9 @@ except ImportError:
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(docutils, "no docutils installed.")
|
@unittest.skipUnless(docutils, "no docutils installed.")
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminDocsTest(TestCase):
|
class AdminDocsTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -4127,9 +4125,9 @@ class AdminDocsTest(TestCase):
|
||||||
self.assertContains(response, '<li><a href="#built_in-add">add</a></li>', html=True)
|
self.assertContains(response, '<li><a href="#built_in-add">add</a></li>', html=True)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class ValidXHTMLTests(TestCase):
|
class ValidXHTMLTests(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
urlbit = 'admin'
|
urlbit = 'admin'
|
||||||
|
|
||||||
|
@ -4152,9 +4150,9 @@ class ValidXHTMLTests(TestCase):
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls",
|
||||||
USE_THOUSAND_SEPARATOR=True, USE_L10N=True)
|
USE_THOUSAND_SEPARATOR=True, USE_L10N=True)
|
||||||
class DateHierarchyTests(TestCase):
|
class DateHierarchyTests(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -4274,13 +4272,13 @@ class DateHierarchyTests(TestCase):
|
||||||
self.assert_non_localized_year(response, 2005)
|
self.assert_non_localized_year(response, 2005)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminCustomSaveRelatedTests(TestCase):
|
class AdminCustomSaveRelatedTests(TestCase):
|
||||||
"""
|
"""
|
||||||
Ensure that one can easily customize the way related objects are saved.
|
Ensure that one can easily customize the way related objects are saved.
|
||||||
Refs #16115.
|
Refs #16115.
|
||||||
"""
|
"""
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -4343,9 +4341,9 @@ class AdminCustomSaveRelatedTests(TestCase):
|
||||||
self.assertEqual(['Catherine Stone', 'Paul Stone'], children_names)
|
self.assertEqual(['Catherine Stone', 'Paul Stone'], children_names)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminViewLogoutTest(TestCase):
|
class AdminViewLogoutTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -4372,9 +4370,9 @@ class AdminViewLogoutTest(TestCase):
|
||||||
self.assertContains(response, '<input type="hidden" name="next" value="/test_admin/admin/" />')
|
self.assertContains(response, '<input type="hidden" name="next" value="/test_admin/admin/" />')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminUserMessageTest(TestCase):
|
class AdminUserMessageTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -4430,9 +4428,9 @@ class AdminUserMessageTest(TestCase):
|
||||||
html=True)
|
html=True)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminKeepChangeListFiltersTests(TestCase):
|
class AdminKeepChangeListFiltersTests(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
admin_site = site
|
admin_site = site
|
||||||
|
|
||||||
|
@ -4716,11 +4714,11 @@ class NamespacedAdminKeepChangeListFiltersTests(AdminKeepChangeListFiltersTests)
|
||||||
admin_site = site2
|
admin_site = site2
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class TestLabelVisibility(TestCase):
|
class TestLabelVisibility(TestCase):
|
||||||
""" #11277 -Labels of hidden fields in admin were not hidden. """
|
""" #11277 -Labels of hidden fields in admin were not hidden. """
|
||||||
|
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml']
|
fixtures = ['admin-views-users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -4757,9 +4755,9 @@ class TestLabelVisibility(TestCase):
|
||||||
self.assertContains(response, '<div class="form-row hidden')
|
self.assertContains(response, '<div class="form-row hidden')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class AdminViewOnSiteTests(TestCase):
|
class AdminViewOnSiteTests(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml', 'admin-views-restaurants.xml']
|
fixtures = ['admin-views-users.xml', 'admin-views-restaurants.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -4878,9 +4876,9 @@ class AdminViewOnSiteTests(TestCase):
|
||||||
self.assertIsNone(model_admin.get_view_on_site_url(Worker()))
|
self.assertIsNone(model_admin.get_view_on_site_url(Worker()))
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="admin_views.urls")
|
||||||
class InlineAdminViewOnSiteTest(TestCase):
|
class InlineAdminViewOnSiteTest(TestCase):
|
||||||
urls = "admin_views.urls"
|
|
||||||
fixtures = ['admin-views-users.xml', 'admin-views-restaurants.xml']
|
fixtures = ['admin-views-users.xml', 'admin-views-restaurants.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
|
@ -181,10 +181,10 @@ class AdminFormfieldForDBFieldTests(TestCase):
|
||||||
self.assertEqual(six.text_type(f.help_text), 'Hold down "Control", or "Command" on a Mac, to select more than one.')
|
self.assertEqual(six.text_type(f.help_text), 'Hold down "Control", or "Command" on a Mac, to select more than one.')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='admin_widgets.urls')
|
||||||
class AdminFormfieldForDBFieldWithRequestTests(DjangoTestCase):
|
class AdminFormfieldForDBFieldWithRequestTests(DjangoTestCase):
|
||||||
fixtures = ["admin-widgets-users.xml"]
|
fixtures = ["admin-widgets-users.xml"]
|
||||||
urls = 'admin_widgets.urls'
|
|
||||||
|
|
||||||
def testFilterChoicesByRequestUser(self):
|
def testFilterChoicesByRequestUser(self):
|
||||||
"""
|
"""
|
||||||
|
@ -196,10 +196,10 @@ class AdminFormfieldForDBFieldWithRequestTests(DjangoTestCase):
|
||||||
self.assertContains(response, "Volkswagon Passat")
|
self.assertContains(response, "Volkswagon Passat")
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='admin_widgets.urls')
|
||||||
class AdminForeignKeyWidgetChangeList(DjangoTestCase):
|
class AdminForeignKeyWidgetChangeList(DjangoTestCase):
|
||||||
fixtures = ["admin-widgets-users.xml"]
|
fixtures = ["admin-widgets-users.xml"]
|
||||||
urls = 'admin_widgets.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.client.login(username="super", password="secret")
|
self.client.login(username="super", password="secret")
|
||||||
|
@ -212,10 +212,10 @@ class AdminForeignKeyWidgetChangeList(DjangoTestCase):
|
||||||
self.assertContains(response, '/auth/user/add/')
|
self.assertContains(response, '/auth/user/add/')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='admin_widgets.urls')
|
||||||
class AdminForeignKeyRawIdWidget(DjangoTestCase):
|
class AdminForeignKeyRawIdWidget(DjangoTestCase):
|
||||||
fixtures = ["admin-widgets-users.xml"]
|
fixtures = ["admin-widgets-users.xml"]
|
||||||
urls = 'admin_widgets.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.client.login(username="super", password="secret")
|
self.client.login(username="super", password="secret")
|
||||||
|
@ -391,8 +391,8 @@ class AdminFileWidgetTest(DjangoTestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='admin_widgets.urls')
|
||||||
class ForeignKeyRawIdWidgetTest(DjangoTestCase):
|
class ForeignKeyRawIdWidgetTest(DjangoTestCase):
|
||||||
urls = 'admin_widgets.urls'
|
|
||||||
|
|
||||||
def test_render(self):
|
def test_render(self):
|
||||||
band = models.Band.objects.create(name='Linkin Park')
|
band = models.Band.objects.create(name='Linkin Park')
|
||||||
|
@ -465,8 +465,8 @@ class ForeignKeyRawIdWidgetTest(DjangoTestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='admin_widgets.urls')
|
||||||
class ManyToManyRawIdWidgetTest(DjangoTestCase):
|
class ManyToManyRawIdWidgetTest(DjangoTestCase):
|
||||||
urls = 'admin_widgets.urls'
|
|
||||||
|
|
||||||
def test_render(self):
|
def test_render(self):
|
||||||
band = models.Band.objects.create(name='Linkin Park')
|
band = models.Band.objects.create(name='Linkin Park')
|
||||||
|
@ -518,12 +518,12 @@ class RelatedFieldWidgetWrapperTests(DjangoTestCase):
|
||||||
self.assertFalse(w.can_add_related)
|
self.assertFalse(w.can_add_related)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='admin_widgets.urls')
|
||||||
class DateTimePickerSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
class DateTimePickerSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
||||||
|
|
||||||
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
|
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
|
||||||
fixtures = ['admin-widgets-users.xml']
|
fixtures = ['admin-widgets-users.xml']
|
||||||
urls = "admin_widgets.urls"
|
|
||||||
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
||||||
|
|
||||||
def test_show_hide_date_time_picker_widgets(self):
|
def test_show_hide_date_time_picker_widgets(self):
|
||||||
|
@ -652,11 +652,11 @@ class DateTimePickerSeleniumIETests(DateTimePickerSeleniumFirefoxTests):
|
||||||
|
|
||||||
@skipIf(pytz is None, "this test requires pytz")
|
@skipIf(pytz is None, "this test requires pytz")
|
||||||
@override_settings(TIME_ZONE='Asia/Singapore')
|
@override_settings(TIME_ZONE='Asia/Singapore')
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='admin_widgets.urls')
|
||||||
class DateTimePickerShortcutsSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
class DateTimePickerShortcutsSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
||||||
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
|
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
|
||||||
fixtures = ['admin-widgets-users.xml']
|
fixtures = ['admin-widgets-users.xml']
|
||||||
urls = "admin_widgets.urls"
|
|
||||||
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
||||||
|
|
||||||
def test_date_time_picker_shortcuts(self):
|
def test_date_time_picker_shortcuts(self):
|
||||||
|
@ -720,12 +720,12 @@ class DateTimePickerShortcutsSeleniumIETests(DateTimePickerShortcutsSeleniumFire
|
||||||
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='admin_widgets.urls')
|
||||||
class HorizontalVerticalFilterSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
class HorizontalVerticalFilterSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
||||||
|
|
||||||
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
|
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
|
||||||
fixtures = ['admin-widgets-users.xml']
|
fixtures = ['admin-widgets-users.xml']
|
||||||
urls = "admin_widgets.urls"
|
|
||||||
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -964,11 +964,11 @@ class HorizontalVerticalFilterSeleniumIETests(HorizontalVerticalFilterSeleniumFi
|
||||||
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='admin_widgets.urls')
|
||||||
class AdminRawIdWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
class AdminRawIdWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
||||||
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
|
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
|
||||||
fixtures = ['admin-widgets-users.xml']
|
fixtures = ['admin-widgets-users.xml']
|
||||||
urls = "admin_widgets.urls"
|
|
||||||
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -1055,11 +1055,11 @@ class AdminRawIdWidgetSeleniumIETests(AdminRawIdWidgetSeleniumFirefoxTests):
|
||||||
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='admin_widgets.urls')
|
||||||
class RelatedFieldWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
class RelatedFieldWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
|
||||||
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
|
available_apps = ['admin_widgets'] + AdminSeleniumWebDriverTestCase.available_apps
|
||||||
fixtures = ['admin-widgets-users.xml']
|
fixtures = ['admin-widgets-users.xml']
|
||||||
urls = "admin_widgets.urls"
|
|
||||||
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
||||||
|
|
||||||
def test_foreign_key_using_to_field(self):
|
def test_foreign_key_using_to_field(self):
|
||||||
|
|
|
@ -2007,9 +2007,9 @@ class TestWithTemplateResponse(TestCase):
|
||||||
self.assertTrue(response.has_header('ETag'))
|
self.assertTrue(response.has_header('ETag'))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF="admin_views.urls")
|
||||||
class TestEtagWithAdmin(TestCase):
|
class TestEtagWithAdmin(TestCase):
|
||||||
# See https://code.djangoproject.com/ticket/16003
|
# See https://code.djangoproject.com/ticket/16003
|
||||||
urls = "admin_views.urls"
|
|
||||||
|
|
||||||
def test_admin(self):
|
def test_admin(self):
|
||||||
with self.settings(USE_ETAGS=False):
|
with self.settings(USE_ETAGS=False):
|
||||||
|
|
|
@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
|
|
||||||
|
|
||||||
FULL_RESPONSE = 'Test conditional get response'
|
FULL_RESPONSE = 'Test conditional get response'
|
||||||
|
@ -16,8 +16,8 @@ ETAG = 'b4246ffc4f62314ca13147c9d4f76974'
|
||||||
EXPIRED_ETAG = '7fae4cd4b0f81e7d2914700043aa8ed6'
|
EXPIRED_ETAG = '7fae4cd4b0f81e7d2914700043aa8ed6'
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='conditional_processing.urls')
|
||||||
class ConditionalGet(TestCase):
|
class ConditionalGet(TestCase):
|
||||||
urls = 'conditional_processing.urls'
|
|
||||||
|
|
||||||
def assertFullResponse(self, response, check_last_modified=True, check_etag=True):
|
def assertFullResponse(self, response, check_last_modified=True, check_etag=True):
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
|
@ -15,9 +15,9 @@ from django.utils.encoding import force_str
|
||||||
from .models import Author, Article, SchemeIncludedURL
|
from .models import Author, Article, SchemeIncludedURL
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='contenttypes_tests.urls')
|
||||||
class ContentTypesViewsTests(TestCase):
|
class ContentTypesViewsTests(TestCase):
|
||||||
fixtures = ['testdata.json']
|
fixtures = ['testdata.json']
|
||||||
urls = 'contenttypes_tests.urls'
|
|
||||||
|
|
||||||
def test_shortcut_with_absolute_url(self):
|
def test_shortcut_with_absolute_url(self):
|
||||||
"Can view a shortcut for an Author object that has a get_absolute_url method"
|
"Can view a shortcut for an Author object that has a get_absolute_url method"
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
"""
|
"""
|
||||||
Tests for Django's bundled context processors.
|
Tests for Django's bundled context processors.
|
||||||
"""
|
"""
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='context_processors.urls')
|
||||||
class RequestContextProcessorTests(TestCase):
|
class RequestContextProcessorTests(TestCase):
|
||||||
"""
|
"""
|
||||||
Tests for the ``django.core.context_processors.request`` processor.
|
Tests for the ``django.core.context_processors.request`` processor.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
urls = 'context_processors.urls'
|
|
||||||
|
|
||||||
def test_request_attributes(self):
|
def test_request_attributes(self):
|
||||||
"""
|
"""
|
||||||
Test that the request object is available in the template and that its
|
Test that the request object is available in the template and that its
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import os
|
||||||
|
import unittest
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from django.test import SimpleTestCase, RequestFactory, override_settings
|
from django.test import SimpleTestCase, RequestFactory, override_settings
|
||||||
from django.utils import six, translation
|
from django.utils import six, translation
|
||||||
from django.utils.deprecation import RenameMethodsBase
|
from django.utils.deprecation import RenameMethodsBase
|
||||||
|
from django.utils.encoding import force_text
|
||||||
from django.utils.functional import memoize
|
from django.utils.functional import memoize
|
||||||
|
|
||||||
|
|
||||||
|
@ -220,3 +223,26 @@ class DeprecatingMemoizeTest(SimpleTestCase):
|
||||||
self.assertEqual(msg,
|
self.assertEqual(msg,
|
||||||
'memoize wrapper is deprecated and will be removed in Django '
|
'memoize wrapper is deprecated and will be removed in Django '
|
||||||
'1.9. Use django.utils.lru_cache instead.')
|
'1.9. Use django.utils.lru_cache instead.')
|
||||||
|
|
||||||
|
|
||||||
|
class DeprecatingSimpleTestCaseUrls(unittest.TestCase):
|
||||||
|
|
||||||
|
def test_deprecation(self):
|
||||||
|
"""
|
||||||
|
Ensure the correct warning is raised when SimpleTestCase.urls is used.
|
||||||
|
"""
|
||||||
|
class TempTestCase(SimpleTestCase):
|
||||||
|
urls = 'tests.urls'
|
||||||
|
|
||||||
|
def test(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
with warnings.catch_warnings(record=True) as recorded:
|
||||||
|
suite = unittest.TestLoader().loadTestsFromTestCase(TempTestCase)
|
||||||
|
with open(os.devnull, 'w') as devnull:
|
||||||
|
unittest.TextTestRunner(stream=devnull, verbosity=2).run(suite)
|
||||||
|
msg = force_text(recorded.pop().message)
|
||||||
|
self.assertEqual(msg,
|
||||||
|
"SimpleTestCase.urls is deprecated and will be removed in "
|
||||||
|
"Django 2.0. Use @override_settings(ROOT_URLCONF=...) "
|
||||||
|
"in TempTestCase instead.")
|
||||||
|
|
|
@ -641,13 +641,13 @@ class ContentFileStorageTestCase(unittest.TestCase):
|
||||||
self.storage.save('unicode.txt', ContentFile("español"))
|
self.storage.save('unicode.txt', ContentFile("español"))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='file_storage.urls')
|
||||||
class FileLikeObjectTestCase(LiveServerTestCase):
|
class FileLikeObjectTestCase(LiveServerTestCase):
|
||||||
"""
|
"""
|
||||||
Test file-like objects (#15644).
|
Test file-like objects (#15644).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
available_apps = []
|
available_apps = []
|
||||||
urls = 'file_storage.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.temp_dir = tempfile.mkdtemp()
|
self.temp_dir = tempfile.mkdtemp()
|
||||||
|
|
|
@ -27,9 +27,8 @@ MEDIA_ROOT = sys_tempfile.mkdtemp()
|
||||||
UPLOAD_TO = os.path.join(MEDIA_ROOT, 'test_upload')
|
UPLOAD_TO = os.path.join(MEDIA_ROOT, 'test_upload')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(MEDIA_ROOT=MEDIA_ROOT)
|
@override_settings(MEDIA_ROOT=MEDIA_ROOT, ROOT_URLCONF='file_uploads.urls')
|
||||||
class FileUploadTests(TestCase):
|
class FileUploadTests(TestCase):
|
||||||
urls = 'file_uploads.urls'
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
|
|
@ -1112,10 +1112,10 @@ class WidgetTests(TestCase):
|
||||||
self.assertFalse(form.is_valid())
|
self.assertFalse(form.is_valid())
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='forms_tests.urls')
|
||||||
class LiveWidgetTests(AdminSeleniumWebDriverTestCase):
|
class LiveWidgetTests(AdminSeleniumWebDriverTestCase):
|
||||||
|
|
||||||
available_apps = ['forms_tests'] + AdminSeleniumWebDriverTestCase.available_apps
|
available_apps = ['forms_tests'] + AdminSeleniumWebDriverTestCase.available_apps
|
||||||
urls = 'forms_tests.urls'
|
|
||||||
|
|
||||||
def test_textarea_trailing_newlines(self):
|
def test_textarea_trailing_newlines(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -18,9 +18,9 @@ from .models import (Episode, EpisodeExtra, EpisodeMaxNum, Media,
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
TEMPLATE_DEBUG=True)
|
TEMPLATE_DEBUG=True,
|
||||||
|
ROOT_URLCONF="generic_inline_admin.urls")
|
||||||
class GenericAdminViewTest(TestCase):
|
class GenericAdminViewTest(TestCase):
|
||||||
urls = "generic_inline_admin.urls"
|
|
||||||
fixtures = ['users.xml']
|
fixtures = ['users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -130,9 +130,9 @@ class GenericAdminViewTest(TestCase):
|
||||||
self.assertTrue(formset.get_queryset().ordered)
|
self.assertTrue(formset.get_queryset().ordered)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="generic_inline_admin.urls")
|
||||||
class GenericInlineAdminParametersTest(TestCase):
|
class GenericInlineAdminParametersTest(TestCase):
|
||||||
urls = "generic_inline_admin.urls"
|
|
||||||
fixtures = ['users.xml']
|
fixtures = ['users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -183,9 +183,9 @@ class GenericInlineAdminParametersTest(TestCase):
|
||||||
self.assertEqual(formset.initial_form_count(), 1)
|
self.assertEqual(formset.initial_form_count(), 1)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF="generic_inline_admin.urls")
|
||||||
class GenericInlineAdminWithUniqueTogetherTest(TestCase):
|
class GenericInlineAdminWithUniqueTogetherTest(TestCase):
|
||||||
urls = "generic_inline_admin.urls"
|
|
||||||
fixtures = ['users.xml']
|
fixtures = ['users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -212,8 +212,8 @@ class GenericInlineAdminWithUniqueTogetherTest(TestCase):
|
||||||
self.assertEqual(response.status_code, 302) # redirect somewhere
|
self.assertEqual(response.status_code, 302) # redirect somewhere
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF="generic_inline_admin.urls")
|
||||||
class NoInlineDeletionTest(TestCase):
|
class NoInlineDeletionTest(TestCase):
|
||||||
urls = "generic_inline_admin.urls"
|
|
||||||
|
|
||||||
def test_no_deletion(self):
|
def test_no_deletion(self):
|
||||||
fake_site = object()
|
fake_site = object()
|
||||||
|
@ -235,8 +235,8 @@ request = MockRequest()
|
||||||
request.user = MockSuperUser()
|
request.user = MockSuperUser()
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF="generic_inline_admin.urls")
|
||||||
class GenericInlineModelAdminTest(TestCase):
|
class GenericInlineModelAdminTest(TestCase):
|
||||||
urls = "generic_inline_admin.urls"
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.site = AdminSite()
|
self.site = AdminSite()
|
||||||
|
|
|
@ -5,7 +5,7 @@ import unittest
|
||||||
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.test import TestCase, RequestFactory
|
from django.test import TestCase, RequestFactory, override_settings
|
||||||
from django.views.generic import View, TemplateView, RedirectView
|
from django.views.generic import View, TemplateView, RedirectView
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
@ -238,8 +238,8 @@ class ViewTest(unittest.TestCase):
|
||||||
self.assertEqual(response.status_code, 405)
|
self.assertEqual(response.status_code, 405)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class TemplateViewTest(TestCase):
|
class TemplateViewTest(TestCase):
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
rf = RequestFactory()
|
rf = RequestFactory()
|
||||||
|
|
||||||
|
@ -327,8 +327,8 @@ class TemplateViewTest(TestCase):
|
||||||
self.assertEqual(response['Content-Type'], 'text/plain')
|
self.assertEqual(response['Content-Type'], 'text/plain')
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class RedirectViewTest(TestCase):
|
class RedirectViewTest(TestCase):
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
rf = RequestFactory()
|
rf = RequestFactory()
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,9 @@ def _make_books(n, base_date):
|
||||||
pubdate=base_date - datetime.timedelta(days=i))
|
pubdate=base_date - datetime.timedelta(days=i))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class ArchiveIndexViewTests(TestCase):
|
class ArchiveIndexViewTests(TestCase):
|
||||||
fixtures = ['generic-views-test-data.json']
|
fixtures = ['generic-views-test-data.json']
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
def test_archive_view(self):
|
def test_archive_view(self):
|
||||||
res = self.client.get('/dates/books/')
|
res = self.client.get('/dates/books/')
|
||||||
|
@ -121,9 +121,9 @@ class ArchiveIndexViewTests(TestCase):
|
||||||
self.assertEqual(list(res.context['date_list']), list(reversed(sorted(res.context['date_list']))))
|
self.assertEqual(list(res.context['date_list']), list(reversed(sorted(res.context['date_list']))))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class YearArchiveViewTests(TestCase):
|
class YearArchiveViewTests(TestCase):
|
||||||
fixtures = ['generic-views-test-data.json']
|
fixtures = ['generic-views-test-data.json']
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
def test_year_view(self):
|
def test_year_view(self):
|
||||||
res = self.client.get('/dates/books/2008/')
|
res = self.client.get('/dates/books/2008/')
|
||||||
|
@ -206,9 +206,9 @@ class YearArchiveViewTests(TestCase):
|
||||||
self.assertEqual(list(res.context['date_list']), list(sorted(res.context['date_list'])))
|
self.assertEqual(list(res.context['date_list']), list(sorted(res.context['date_list'])))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class MonthArchiveViewTests(TestCase):
|
class MonthArchiveViewTests(TestCase):
|
||||||
fixtures = ['generic-views-test-data.json']
|
fixtures = ['generic-views-test-data.json']
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
def test_month_view(self):
|
def test_month_view(self):
|
||||||
res = self.client.get('/dates/books/2008/oct/')
|
res = self.client.get('/dates/books/2008/oct/')
|
||||||
|
@ -333,9 +333,9 @@ class MonthArchiveViewTests(TestCase):
|
||||||
self.assertEqual(list(res.context['date_list']), list(sorted(res.context['date_list'])))
|
self.assertEqual(list(res.context['date_list']), list(sorted(res.context['date_list'])))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class WeekArchiveViewTests(TestCase):
|
class WeekArchiveViewTests(TestCase):
|
||||||
fixtures = ['generic-views-test-data.json']
|
fixtures = ['generic-views-test-data.json']
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
def test_week_view(self):
|
def test_week_view(self):
|
||||||
res = self.client.get('/dates/books/2008/week/39/')
|
res = self.client.get('/dates/books/2008/week/39/')
|
||||||
|
@ -430,9 +430,9 @@ class WeekArchiveViewTests(TestCase):
|
||||||
self.assertEqual(res.status_code, 200)
|
self.assertEqual(res.status_code, 200)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class DayArchiveViewTests(TestCase):
|
class DayArchiveViewTests(TestCase):
|
||||||
fixtures = ['generic-views-test-data.json']
|
fixtures = ['generic-views-test-data.json']
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
def test_day_view(self):
|
def test_day_view(self):
|
||||||
res = self.client.get('/dates/books/2008/oct/01/')
|
res = self.client.get('/dates/books/2008/oct/01/')
|
||||||
|
@ -548,9 +548,9 @@ class DayArchiveViewTests(TestCase):
|
||||||
self.assertEqual(res.status_code, 404)
|
self.assertEqual(res.status_code, 404)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class DateDetailViewTests(TestCase):
|
class DateDetailViewTests(TestCase):
|
||||||
fixtures = ['generic-views-test-data.json']
|
fixtures = ['generic-views-test-data.json']
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
def test_date_detail_by_pk(self):
|
def test_date_detail_by_pk(self):
|
||||||
res = self.client.get('/dates/books/2008/oct/01/1/')
|
res = self.client.get('/dates/books/2008/oct/01/1/')
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
|
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
from django.views.generic.base import View
|
from django.views.generic.base import View
|
||||||
|
|
||||||
from .models import Artist, Author, Page
|
from .models import Artist, Author, Page
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class DetailViewTest(TestCase):
|
class DetailViewTest(TestCase):
|
||||||
fixtures = ['generic-views-test-data.json']
|
fixtures = ['generic-views-test-data.json']
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
def test_simple_object(self):
|
def test_simple_object(self):
|
||||||
res = self.client.get('/detail/obj/')
|
res = self.client.get('/detail/obj/')
|
||||||
|
|
|
@ -5,7 +5,7 @@ from unittest import expectedFailure
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
from django.test.client import RequestFactory
|
from django.test.client import RequestFactory
|
||||||
from django.views.generic.base import View
|
from django.views.generic.base import View
|
||||||
from django.views.generic.edit import FormMixin, ModelFormMixin, CreateView
|
from django.views.generic.edit import FormMixin, ModelFormMixin, CreateView
|
||||||
|
@ -41,8 +41,8 @@ class FormMixinTests(TestCase):
|
||||||
self.assertEqual(test_string, set_kwargs.get('prefix'))
|
self.assertEqual(test_string, set_kwargs.get('prefix'))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class BasicFormTests(TestCase):
|
class BasicFormTests(TestCase):
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
def test_post_data(self):
|
def test_post_data(self):
|
||||||
res = self.client.post('/contact/', {'name': "Me", 'message': "Hello"})
|
res = self.client.post('/contact/', {'name': "Me", 'message': "Hello"})
|
||||||
|
@ -61,8 +61,8 @@ class ModelFormMixinTests(TestCase):
|
||||||
mixin.get_form_kwargs())
|
mixin.get_form_kwargs())
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class CreateViewTests(TestCase):
|
class CreateViewTests(TestCase):
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
def test_create(self):
|
def test_create(self):
|
||||||
res = self.client.get('/edit/authors/create/')
|
res = self.client.get('/edit/authors/create/')
|
||||||
|
@ -168,8 +168,8 @@ class CreateViewTests(TestCase):
|
||||||
MyCreateView().get_form_class()
|
MyCreateView().get_form_class()
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class UpdateViewTests(TestCase):
|
class UpdateViewTests(TestCase):
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
def test_update_post(self):
|
def test_update_post(self):
|
||||||
a = Author.objects.create(
|
a = Author.objects.create(
|
||||||
|
@ -305,8 +305,8 @@ class UpdateViewTests(TestCase):
|
||||||
self.assertQuerysetEqual(Author.objects.all(), ['<Author: Randall Munroe (xkcd)>'])
|
self.assertQuerysetEqual(Author.objects.all(), ['<Author: Randall Munroe (xkcd)>'])
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class DeleteViewTests(TestCase):
|
class DeleteViewTests(TestCase):
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
def test_delete_by_post(self):
|
def test_delete_by_post(self):
|
||||||
a = Author.objects.create(**{'name': 'Randall Munroe', 'slug': 'randall-munroe'})
|
a = Author.objects.create(**{'name': 'Randall Munroe', 'slug': 'randall-munroe'})
|
||||||
|
|
|
@ -8,9 +8,9 @@ from django.utils.encoding import force_str
|
||||||
from .models import Author, Artist
|
from .models import Author, Artist
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||||
class ListViewTests(TestCase):
|
class ListViewTests(TestCase):
|
||||||
fixtures = ['generic-views-test-data.json']
|
fixtures = ['generic-views-test-data.json']
|
||||||
urls = 'generic_views.urls'
|
|
||||||
|
|
||||||
def test_items(self):
|
def test_items(self):
|
||||||
res = self.client.get('/list/dict/')
|
res = self.client.get('/list/dict/')
|
||||||
|
|
|
@ -65,10 +65,10 @@ class HandlerTests(TestCase):
|
||||||
self.assertEqual(request.COOKIES['want'], force_str("café"))
|
self.assertEqual(request.COOKIES['want'], force_str("café"))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='handlers.urls')
|
||||||
class TransactionsPerRequestTests(TransactionTestCase):
|
class TransactionsPerRequestTests(TransactionTestCase):
|
||||||
|
|
||||||
available_apps = []
|
available_apps = []
|
||||||
urls = 'handlers.urls'
|
|
||||||
|
|
||||||
def test_no_transaction(self):
|
def test_no_transaction(self):
|
||||||
response = self.client.get('/in_transaction/')
|
response = self.client.get('/in_transaction/')
|
||||||
|
@ -93,8 +93,8 @@ class TransactionsPerRequestTests(TransactionTestCase):
|
||||||
self.assertContains(response, 'False')
|
self.assertContains(response, 'False')
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='handlers.urls')
|
||||||
class SignalsTests(TestCase):
|
class SignalsTests(TestCase):
|
||||||
urls = 'handlers.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.signals = []
|
self.signals = []
|
||||||
|
@ -123,8 +123,8 @@ class SignalsTests(TestCase):
|
||||||
self.assertEqual(self.signals, ['started', 'finished'])
|
self.assertEqual(self.signals, ['started', 'finished'])
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='handlers.urls')
|
||||||
class HandlerSuspiciousOpsTest(TestCase):
|
class HandlerSuspiciousOpsTest(TestCase):
|
||||||
urls = 'handlers.urls'
|
|
||||||
|
|
||||||
def test_suspiciousop_in_view_returns_400(self):
|
def test_suspiciousop_in_view_returns_400(self):
|
||||||
response = self.client.get('/suspicious/')
|
response = self.client.get('/suspicious/')
|
||||||
|
|
|
@ -34,12 +34,12 @@ class PermanentRedirectLocaleMiddleWare(LocaleMiddleware):
|
||||||
'django.middleware.locale.LocaleMiddleware',
|
'django.middleware.locale.LocaleMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
),
|
),
|
||||||
|
ROOT_URLCONF='i18n.patterns.urls.default',
|
||||||
)
|
)
|
||||||
class URLTestCaseBase(TestCase):
|
class URLTestCaseBase(TestCase):
|
||||||
"""
|
"""
|
||||||
TestCase base-class for the URL tests.
|
TestCase base-class for the URL tests.
|
||||||
"""
|
"""
|
||||||
urls = 'i18n.patterns.urls.default'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
# Make sure the cache is empty before we are doing our tests.
|
# Make sure the cache is empty before we are doing our tests.
|
||||||
|
@ -73,8 +73,8 @@ class URLPrefixTests(URLTestCaseBase):
|
||||||
self.assertRaises(ImproperlyConfigured, lambda: reverse('account:register'))
|
self.assertRaises(ImproperlyConfigured, lambda: reverse('account:register'))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='i18n.patterns.urls.disabled')
|
||||||
class URLDisabledTests(URLTestCaseBase):
|
class URLDisabledTests(URLTestCaseBase):
|
||||||
urls = 'i18n.patterns.urls.disabled'
|
|
||||||
|
|
||||||
@override_settings(USE_I18N=False)
|
@override_settings(USE_I18N=False)
|
||||||
def test_prefixed_i18n_disabled(self):
|
def test_prefixed_i18n_disabled(self):
|
||||||
|
@ -84,12 +84,12 @@ class URLDisabledTests(URLTestCaseBase):
|
||||||
self.assertEqual(reverse('prefixed'), '/prefixed/')
|
self.assertEqual(reverse('prefixed'), '/prefixed/')
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='i18n.patterns.urls.path_unused')
|
||||||
class PathUnusedTests(URLTestCaseBase):
|
class PathUnusedTests(URLTestCaseBase):
|
||||||
"""
|
"""
|
||||||
Check that if no i18n_patterns is used in root urlconfs, then no
|
Check that if no i18n_patterns is used in root urlconfs, then no
|
||||||
language activation happens based on url prefix.
|
language activation happens based on url prefix.
|
||||||
"""
|
"""
|
||||||
urls = 'i18n.patterns.urls.path_unused'
|
|
||||||
|
|
||||||
def test_no_lang_activate(self):
|
def test_no_lang_activate(self):
|
||||||
response = self.client.get('/nl/foo/')
|
response = self.client.get('/nl/foo/')
|
||||||
|
|
|
@ -1261,11 +1261,10 @@ class MultipleLocaleActivationTests(TestCase):
|
||||||
'django.middleware.locale.LocaleMiddleware',
|
'django.middleware.locale.LocaleMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
),
|
),
|
||||||
|
ROOT_URLCONF='i18n.urls',
|
||||||
)
|
)
|
||||||
class LocaleMiddlewareTests(TestCase):
|
class LocaleMiddlewareTests(TestCase):
|
||||||
|
|
||||||
urls = 'i18n.urls'
|
|
||||||
|
|
||||||
def test_streaming_response(self):
|
def test_streaming_response(self):
|
||||||
# Regression test for #5241
|
# Regression test for #5241
|
||||||
response = self.client.get('/fr/streaming/')
|
response = self.client.get('/fr/streaming/')
|
||||||
|
@ -1299,11 +1298,10 @@ class LocaleMiddlewareTests(TestCase):
|
||||||
'django.middleware.locale.LocaleMiddleware',
|
'django.middleware.locale.LocaleMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
),
|
),
|
||||||
|
ROOT_URLCONF='i18n.urls'
|
||||||
)
|
)
|
||||||
class CountrySpecificLanguageTests(TestCase):
|
class CountrySpecificLanguageTests(TestCase):
|
||||||
|
|
||||||
urls = 'i18n.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(CountrySpecificLanguageTests, self).setUp()
|
super(CountrySpecificLanguageTests, self).setUp()
|
||||||
self.rf = RequestFactory()
|
self.rf = RequestFactory()
|
||||||
|
|
|
@ -363,11 +363,9 @@ class SetupConfigureLogging(TestCase):
|
||||||
self.assertTrue(dictConfig.called)
|
self.assertTrue(dictConfig.called)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(DEBUG=True)
|
@override_settings(DEBUG=True, ROOT_URLCONF='logging_tests.urls')
|
||||||
class SecurityLoggerTest(TestCase):
|
class SecurityLoggerTest(TestCase):
|
||||||
|
|
||||||
urls = 'logging_tests.urls'
|
|
||||||
|
|
||||||
def test_suspicious_operation_creates_log_message(self):
|
def test_suspicious_operation_creates_log_message(self):
|
||||||
with patch_logger('django.security.SuspiciousOperation', 'error') as calls:
|
with patch_logger('django.security.SuspiciousOperation', 'error') as calls:
|
||||||
self.client.get('/suspicious/')
|
self.client.get('/suspicious/')
|
||||||
|
|
|
@ -20,8 +20,8 @@ from django.utils.encoding import force_str
|
||||||
from django.utils.six.moves import xrange
|
from django.utils.six.moves import xrange
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='middleware.urls')
|
||||||
class CommonMiddlewareTest(TestCase):
|
class CommonMiddlewareTest(TestCase):
|
||||||
urls = 'middleware.urls'
|
|
||||||
|
|
||||||
def _get_request(self, path):
|
def _get_request(self, path):
|
||||||
request = HttpRequest()
|
request = HttpRequest()
|
||||||
|
@ -303,8 +303,8 @@ class BrokenLinkEmailsMiddlewareTest(TestCase):
|
||||||
self.assertEqual(len(mail.outbox), 1)
|
self.assertEqual(len(mail.outbox), 1)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='middleware.cond_get_urls')
|
||||||
class ConditionalGetMiddlewareTest(TestCase):
|
class ConditionalGetMiddlewareTest(TestCase):
|
||||||
urls = 'middleware.cond_get_urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.req = HttpRequest()
|
self.req = HttpRequest()
|
||||||
|
|
|
@ -101,8 +101,8 @@ class BadExceptionMiddleware(TestMiddleware):
|
||||||
raise TestException('Test Exception Exception')
|
raise TestException('Test Exception Exception')
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='middleware_exceptions.urls')
|
||||||
class BaseMiddlewareExceptionTest(TestCase):
|
class BaseMiddlewareExceptionTest(TestCase):
|
||||||
urls = 'middleware_exceptions.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.exceptions = []
|
self.exceptions = []
|
||||||
|
@ -779,8 +779,8 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
|
||||||
_missing = object()
|
_missing = object()
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='middleware_exceptions.urls')
|
||||||
class RootUrlconfTests(TestCase):
|
class RootUrlconfTests(TestCase):
|
||||||
urls = 'middleware_exceptions.urls'
|
|
||||||
|
|
||||||
@override_settings(ROOT_URLCONF=None)
|
@override_settings(ROOT_URLCONF=None)
|
||||||
def test_missing_root_urlconf(self):
|
def test_missing_root_urlconf(self):
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
|
|
||||||
from .models import Guitarist
|
from .models import Guitarist
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='model_permalink.urls')
|
||||||
class PermalinkTests(TestCase):
|
class PermalinkTests(TestCase):
|
||||||
urls = 'model_permalink.urls'
|
|
||||||
|
|
||||||
def test_permalink(self):
|
def test_permalink(self):
|
||||||
g = Guitarist(name='Adrien Moignard', slug='adrienmoignard')
|
g = Guitarist(name='Adrien Moignard', slug='adrienmoignard')
|
||||||
|
|
|
@ -368,10 +368,10 @@ class ProxyModelTests(TestCase):
|
||||||
self.assertEqual(MyPerson(id=100), Person(id=100))
|
self.assertEqual(MyPerson(id=100), Person(id=100))
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='proxy_models.urls',)
|
||||||
class ProxyModelAdminTests(TestCase):
|
class ProxyModelAdminTests(TestCase):
|
||||||
fixtures = ['myhorses']
|
fixtures = ['myhorses']
|
||||||
urls = 'proxy_models.urls'
|
|
||||||
|
|
||||||
def test_cascade_delete_proxy_model_admin_warning(self):
|
def test_cascade_delete_proxy_model_admin_warning(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -3,16 +3,16 @@ from __future__ import unicode_literals
|
||||||
from django.core.urlresolvers import NoReverseMatch
|
from django.core.urlresolvers import NoReverseMatch
|
||||||
from django.contrib.auth.views import logout
|
from django.contrib.auth.views import logout
|
||||||
from django.shortcuts import resolve_url
|
from django.shortcuts import resolve_url
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
|
|
||||||
from .models import UnimportantThing
|
from .models import UnimportantThing
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='resolve_url.urls')
|
||||||
class ResolveUrlTests(TestCase):
|
class ResolveUrlTests(TestCase):
|
||||||
"""
|
"""
|
||||||
Tests for the ``resolve_url`` function.
|
Tests for the ``resolve_url`` function.
|
||||||
"""
|
"""
|
||||||
urls = 'resolve_url.urls'
|
|
||||||
|
|
||||||
def test_url_path(self):
|
def test_url_path(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -27,6 +27,7 @@ TEST_SETTINGS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='servers.urls')
|
||||||
class LiveServerBase(LiveServerTestCase):
|
class LiveServerBase(LiveServerTestCase):
|
||||||
|
|
||||||
available_apps = [
|
available_apps = [
|
||||||
|
@ -36,7 +37,6 @@ class LiveServerBase(LiveServerTestCase):
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
]
|
]
|
||||||
fixtures = ['testdata.json']
|
fixtures = ['testdata.json']
|
||||||
urls = 'servers.urls'
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
|
|
@ -735,11 +735,11 @@ class TestCollectionLinks(CollectionTestCase, TestDefaults):
|
||||||
self.assertTrue(os.path.islink(path))
|
self.assertTrue(os.path.islink(path))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='staticfiles_tests.urls.default')
|
||||||
class TestServeStatic(StaticFilesTestCase):
|
class TestServeStatic(StaticFilesTestCase):
|
||||||
"""
|
"""
|
||||||
Test static asset serving view.
|
Test static asset serving view.
|
||||||
"""
|
"""
|
||||||
urls = 'staticfiles_tests.urls.default'
|
|
||||||
|
|
||||||
def _response(self, filepath):
|
def _response(self, filepath):
|
||||||
return self.client.get(
|
return self.client.get(
|
||||||
|
@ -771,11 +771,11 @@ class TestServeStaticWithDefaultURL(TestServeStatic, TestDefaults):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='staticfiles_tests.urls.helper')
|
||||||
class TestServeStaticWithURLHelper(TestServeStatic, TestDefaults):
|
class TestServeStaticWithURLHelper(TestServeStatic, TestDefaults):
|
||||||
"""
|
"""
|
||||||
Test static asset serving view with staticfiles_urlpatterns helper.
|
Test static asset serving view with staticfiles_urlpatterns helper.
|
||||||
"""
|
"""
|
||||||
urls = 'staticfiles_tests.urls.helper'
|
|
||||||
|
|
||||||
|
|
||||||
class TestServeAdminMedia(TestServeStatic):
|
class TestServeAdminMedia(TestServeStatic):
|
||||||
|
|
|
@ -10,7 +10,7 @@ except ImportError:
|
||||||
|
|
||||||
from django.contrib.syndication import views
|
from django.contrib.syndication import views
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
from django.test.utils import requires_tz_support
|
from django.test.utils import requires_tz_support
|
||||||
from django.utils.feedgenerator import rfc2822_date, rfc3339_date
|
from django.utils.feedgenerator import rfc2822_date, rfc3339_date
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
@ -50,11 +50,11 @@ class FeedTestCase(TestCase):
|
||||||
######################################
|
######################################
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='syndication_tests.urls')
|
||||||
class SyndicationFeedTest(FeedTestCase):
|
class SyndicationFeedTest(FeedTestCase):
|
||||||
"""
|
"""
|
||||||
Tests for the high-level syndication feed framework.
|
Tests for the high-level syndication feed framework.
|
||||||
"""
|
"""
|
||||||
urls = 'syndication_tests.urls'
|
|
||||||
|
|
||||||
def test_rss2_feed(self):
|
def test_rss2_feed(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -302,10 +302,10 @@ class TemplateResponseTest(TestCase):
|
||||||
@override_settings(
|
@override_settings(
|
||||||
MIDDLEWARE_CLASSES=list(settings.MIDDLEWARE_CLASSES) + [
|
MIDDLEWARE_CLASSES=list(settings.MIDDLEWARE_CLASSES) + [
|
||||||
'template_tests.test_response.CustomURLConfMiddleware'
|
'template_tests.test_response.CustomURLConfMiddleware'
|
||||||
]
|
],
|
||||||
|
ROOT_URLCONF='template_tests.urls',
|
||||||
)
|
)
|
||||||
class CustomURLConfTest(TestCase):
|
class CustomURLConfTest(TestCase):
|
||||||
urls = 'template_tests.urls'
|
|
||||||
|
|
||||||
def test_custom_urlconf(self):
|
def test_custom_urlconf(self):
|
||||||
response = self.client.get('/template_response_view/')
|
response = self.client.get('/template_response_view/')
|
||||||
|
@ -318,10 +318,10 @@ class CustomURLConfTest(TestCase):
|
||||||
MIDDLEWARE_CLASSES=list(settings.MIDDLEWARE_CLASSES) + [
|
MIDDLEWARE_CLASSES=list(settings.MIDDLEWARE_CLASSES) + [
|
||||||
'django.middleware.cache.FetchFromCacheMiddleware',
|
'django.middleware.cache.FetchFromCacheMiddleware',
|
||||||
'django.middleware.cache.UpdateCacheMiddleware',
|
'django.middleware.cache.UpdateCacheMiddleware',
|
||||||
]
|
],
|
||||||
|
ROOT_URLCONF='template_tests.alternate_urls',
|
||||||
)
|
)
|
||||||
class CacheMiddlewareTest(TestCase):
|
class CacheMiddlewareTest(TestCase):
|
||||||
urls = 'template_tests.alternate_urls'
|
|
||||||
|
|
||||||
def test_middleware_caching(self):
|
def test_middleware_caching(self):
|
||||||
response = self.client.get('/template_response_view/')
|
response = self.client.get('/template_response_view/')
|
||||||
|
|
|
@ -529,9 +529,9 @@ class TemplateRegressionTests(TestCase):
|
||||||
@override_settings(MEDIA_URL="/media/", STATIC_URL="/static/",
|
@override_settings(MEDIA_URL="/media/", STATIC_URL="/static/",
|
||||||
TEMPLATE_DEBUG=False, ALLOWED_INCLUDE_ROOTS=(
|
TEMPLATE_DEBUG=False, ALLOWED_INCLUDE_ROOTS=(
|
||||||
os.path.dirname(os.path.abspath(upath(__file__))),),
|
os.path.dirname(os.path.abspath(upath(__file__))),),
|
||||||
|
ROOT_URLCONF='template_tests.urls',
|
||||||
)
|
)
|
||||||
class TemplateTests(TestCase):
|
class TemplateTests(TestCase):
|
||||||
urls = 'template_tests.urls'
|
|
||||||
|
|
||||||
def test_templates(self):
|
def test_templates(self):
|
||||||
template_tests = self.get_template_tests()
|
template_tests = self.get_template_tests()
|
||||||
|
|
|
@ -29,10 +29,10 @@ from django.test import override_settings
|
||||||
from .views import get_view
|
from .views import get_view
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='test_client.urls',)
|
||||||
class ClientTest(TestCase):
|
class ClientTest(TestCase):
|
||||||
fixtures = ['testdata.json']
|
fixtures = ['testdata.json']
|
||||||
urls = 'test_client.urls'
|
|
||||||
|
|
||||||
def test_get_view(self):
|
def test_get_view(self):
|
||||||
"GET a view"
|
"GET a view"
|
||||||
|
@ -499,10 +499,10 @@ class ClientTest(TestCase):
|
||||||
|
|
||||||
|
|
||||||
@override_settings(
|
@override_settings(
|
||||||
MIDDLEWARE_CLASSES=('django.middleware.csrf.CsrfViewMiddleware',)
|
MIDDLEWARE_CLASSES=('django.middleware.csrf.CsrfViewMiddleware',),
|
||||||
|
ROOT_URLCONF='test_client.urls',
|
||||||
)
|
)
|
||||||
class CSRFEnabledClientTests(TestCase):
|
class CSRFEnabledClientTests(TestCase):
|
||||||
urls = 'test_client.urls'
|
|
||||||
|
|
||||||
def test_csrf_enabled_client(self):
|
def test_csrf_enabled_client(self):
|
||||||
"A client can be instantiated with CSRF checks enabled"
|
"A client can be instantiated with CSRF checks enabled"
|
||||||
|
@ -529,8 +529,8 @@ class CustomTestClientTest(TestCase):
|
||||||
self.assertEqual(hasattr(self.client, "i_am_customized"), True)
|
self.assertEqual(hasattr(self.client, "i_am_customized"), True)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client.urls')
|
||||||
class RequestFactoryTest(TestCase):
|
class RequestFactoryTest(TestCase):
|
||||||
urls = 'test_client.urls'
|
|
||||||
|
|
||||||
def test_request_factory(self):
|
def test_request_factory(self):
|
||||||
factory = RequestFactory()
|
factory = RequestFactory()
|
||||||
|
|
|
@ -27,10 +27,10 @@ from .views import CustomTestException
|
||||||
|
|
||||||
|
|
||||||
@override_settings(
|
@override_settings(
|
||||||
TEMPLATE_DIRS=(os.path.join(os.path.dirname(upath(__file__)), 'templates'),)
|
TEMPLATE_DIRS=(os.path.join(os.path.dirname(upath(__file__)), 'templates'),),
|
||||||
|
ROOT_URLCONF='test_client_regress.urls',
|
||||||
)
|
)
|
||||||
class AssertContainsTests(TestCase):
|
class AssertContainsTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
|
|
||||||
def test_contains(self):
|
def test_contains(self):
|
||||||
"Responses can be inspected for content, including counting repeated substrings"
|
"Responses can be inspected for content, including counting repeated substrings"
|
||||||
|
@ -191,9 +191,9 @@ class AssertContainsTests(TestCase):
|
||||||
self.assertNotContains(response, 'Bye')
|
self.assertNotContains(response, 'Bye')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='test_client_regress.urls',)
|
||||||
class AssertTemplateUsedTests(TestCase):
|
class AssertTemplateUsedTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
fixtures = ['testdata.json']
|
fixtures = ['testdata.json']
|
||||||
|
|
||||||
def test_no_context(self):
|
def test_no_context(self):
|
||||||
|
@ -264,8 +264,8 @@ class AssertTemplateUsedTests(TestCase):
|
||||||
self.assertIn("Template 'Valid POST Template' was not a template used to render the response. Actual template(s) used: form_view.html, base.html", str(e))
|
self.assertIn("Template 'Valid POST Template' was not a template used to render the response. Actual template(s) used: form_view.html, base.html", str(e))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls')
|
||||||
class AssertRedirectsTests(TestCase):
|
class AssertRedirectsTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
|
|
||||||
def test_redirect_page(self):
|
def test_redirect_page(self):
|
||||||
"An assertion is raised if the original page couldn't be retrieved as expected"
|
"An assertion is raised if the original page couldn't be retrieved as expected"
|
||||||
|
@ -459,8 +459,8 @@ class AssertRedirectsTests(TestCase):
|
||||||
self.assertRedirects(response, 'http://testserver/secure_view/', status_code=301)
|
self.assertRedirects(response, 'http://testserver/secure_view/', status_code=301)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls')
|
||||||
class AssertFormErrorTests(TestCase):
|
class AssertFormErrorTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
|
|
||||||
def test_unknown_form(self):
|
def test_unknown_form(self):
|
||||||
"An assertion is raised if the form name is unknown"
|
"An assertion is raised if the form name is unknown"
|
||||||
|
@ -576,8 +576,8 @@ class AssertFormErrorTests(TestCase):
|
||||||
self.assertIn("abc: The form 'form' in context 0 does not contain the non-field error 'Some error.' (actual errors: )", str(e))
|
self.assertIn("abc: The form 'form' in context 0 does not contain the non-field error 'Some error.' (actual errors: )", str(e))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls')
|
||||||
class AssertFormsetErrorTests(TestCase):
|
class AssertFormsetErrorTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
msg_prefixes = [("", {}), ("abc: ", {"msg_prefix": "abc"})]
|
msg_prefixes = [("", {}), ("abc: ", {"msg_prefix": "abc"})]
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -775,9 +775,9 @@ class ProcessedMiddleware(object):
|
||||||
request.has_been_processed = True
|
request.has_been_processed = True
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='test_client_regress.urls',)
|
||||||
class LoginTests(TestCase):
|
class LoginTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
fixtures = ['testdata']
|
fixtures = ['testdata']
|
||||||
|
|
||||||
def test_login_different_client(self):
|
def test_login_different_client(self):
|
||||||
|
@ -817,10 +817,10 @@ class LoginTests(TestCase):
|
||||||
|
|
||||||
@override_settings(
|
@override_settings(
|
||||||
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
SESSION_ENGINE='test_client_regress.session'
|
SESSION_ENGINE='test_client_regress.session',
|
||||||
|
ROOT_URLCONF='test_client_regress.urls',
|
||||||
)
|
)
|
||||||
class SessionEngineTests(TestCase):
|
class SessionEngineTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
fixtures = ['testdata']
|
fixtures = ['testdata']
|
||||||
|
|
||||||
def test_login(self):
|
def test_login(self):
|
||||||
|
@ -834,8 +834,8 @@ class SessionEngineTests(TestCase):
|
||||||
self.assertEqual(response.context['user'].username, 'testclient')
|
self.assertEqual(response.context['user'].username, 'testclient')
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls',)
|
||||||
class URLEscapingTests(TestCase):
|
class URLEscapingTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
|
|
||||||
def test_simple_argument_get(self):
|
def test_simple_argument_get(self):
|
||||||
"Get a view that has a simple string argument"
|
"Get a view that has a simple string argument"
|
||||||
|
@ -862,9 +862,9 @@ class URLEscapingTests(TestCase):
|
||||||
self.assertEqual(response.content, b'Hi, Arthur')
|
self.assertEqual(response.content, b'Hi, Arthur')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='test_client_regress.urls',)
|
||||||
class ExceptionTests(TestCase):
|
class ExceptionTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
fixtures = ['testdata.json']
|
fixtures = ['testdata.json']
|
||||||
|
|
||||||
def test_exception_cleared(self):
|
def test_exception_cleared(self):
|
||||||
|
@ -889,8 +889,8 @@ class ExceptionTests(TestCase):
|
||||||
self.fail("Staff should be able to visit this page")
|
self.fail("Staff should be able to visit this page")
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls')
|
||||||
class TemplateExceptionTests(TestCase):
|
class TemplateExceptionTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
# Reset the loaders so they don't try to render cached templates.
|
# Reset the loaders so they don't try to render cached templates.
|
||||||
|
@ -914,8 +914,8 @@ class TemplateExceptionTests(TestCase):
|
||||||
# We need two different tests to check URLconf substitution - one to check
|
# We need two different tests to check URLconf substitution - one to check
|
||||||
# it was changed, and another one (without self.urls) to check it was reverted on
|
# it was changed, and another one (without self.urls) to check it was reverted on
|
||||||
# teardown. This pair of tests relies upon the alphabetical ordering of test execution.
|
# teardown. This pair of tests relies upon the alphabetical ordering of test execution.
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls')
|
||||||
class UrlconfSubstitutionTests(TestCase):
|
class UrlconfSubstitutionTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
|
|
||||||
def test_urlconf_was_changed(self):
|
def test_urlconf_was_changed(self):
|
||||||
"TestCase can enforce a custom URLconf on a per-test basis"
|
"TestCase can enforce a custom URLconf on a per-test basis"
|
||||||
|
@ -936,9 +936,9 @@ class zzUrlconfSubstitutionTests(TestCase):
|
||||||
reverse('arg_view', args=['somename'])
|
reverse('arg_view', args=['somename'])
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='test_client_regress.urls',)
|
||||||
class ContextTests(TestCase):
|
class ContextTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
fixtures = ['testdata']
|
fixtures = ['testdata']
|
||||||
|
|
||||||
def test_single_context(self):
|
def test_single_context(self):
|
||||||
|
@ -1007,9 +1007,9 @@ class ContextTests(TestCase):
|
||||||
self.assertEqual(response.context['nested'], 'yes')
|
self.assertEqual(response.context['nested'], 'yes')
|
||||||
|
|
||||||
|
|
||||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='test_client_regress.urls',)
|
||||||
class SessionTests(TestCase):
|
class SessionTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
fixtures = ['testdata.json']
|
fixtures = ['testdata.json']
|
||||||
|
|
||||||
def test_session(self):
|
def test_session(self):
|
||||||
|
@ -1116,8 +1116,8 @@ class SessionTests(TestCase):
|
||||||
self.assertFalse(listener.executed)
|
self.assertFalse(listener.executed)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls')
|
||||||
class RequestMethodTests(TestCase):
|
class RequestMethodTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
|
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
"Request a view via request method GET"
|
"Request a view via request method GET"
|
||||||
|
@ -1164,8 +1164,8 @@ class RequestMethodTests(TestCase):
|
||||||
self.assertEqual(response.content, b'request method: PATCH')
|
self.assertEqual(response.content, b'request method: PATCH')
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls')
|
||||||
class RequestMethodStringDataTests(TestCase):
|
class RequestMethodStringDataTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
|
|
||||||
def test_post(self):
|
def test_post(self):
|
||||||
"Request a view with string data via request method POST"
|
"Request a view with string data via request method POST"
|
||||||
|
@ -1192,8 +1192,8 @@ class RequestMethodStringDataTests(TestCase):
|
||||||
self.assertEqual(response.content, b'request method: PATCH')
|
self.assertEqual(response.content, b'request method: PATCH')
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls',)
|
||||||
class QueryStringTests(TestCase):
|
class QueryStringTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
|
|
||||||
def test_get_like_requests(self):
|
def test_get_like_requests(self):
|
||||||
# See: https://code.djangoproject.com/ticket/10571.
|
# See: https://code.djangoproject.com/ticket/10571.
|
||||||
|
@ -1247,8 +1247,8 @@ class QueryStringTests(TestCase):
|
||||||
self.assertEqual(response.context['request-bar'], 'bang')
|
self.assertEqual(response.context['request-bar'], 'bang')
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls')
|
||||||
class UnicodePayloadTests(TestCase):
|
class UnicodePayloadTests(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
|
|
||||||
def test_simple_unicode_payload(self):
|
def test_simple_unicode_payload(self):
|
||||||
"A simple ASCII-only unicode JSON document can be POSTed"
|
"A simple ASCII-only unicode JSON document can be POSTed"
|
||||||
|
@ -1312,8 +1312,8 @@ class UploadedFileEncodingTest(TestCase):
|
||||||
encode_file('IGNORE', 'IGNORE', DummyFile("file.unknown"))[2])
|
encode_file('IGNORE', 'IGNORE', DummyFile("file.unknown"))[2])
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls',)
|
||||||
class RequestHeadersTest(TestCase):
|
class RequestHeadersTest(TestCase):
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
fixtures = ['testdata']
|
fixtures = ['testdata']
|
||||||
|
|
||||||
def test_client_headers(self):
|
def test_client_headers(self):
|
||||||
|
@ -1348,6 +1348,7 @@ class RequestHeadersTest(TestCase):
|
||||||
status_code=301, target_status_code=200)
|
status_code=301, target_status_code=200)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls')
|
||||||
class ReadLimitedStreamTest(TestCase):
|
class ReadLimitedStreamTest(TestCase):
|
||||||
"""
|
"""
|
||||||
Tests that ensure that HttpRequest.body, HttpRequest.read() and
|
Tests that ensure that HttpRequest.body, HttpRequest.read() and
|
||||||
|
@ -1355,7 +1356,6 @@ class ReadLimitedStreamTest(TestCase):
|
||||||
|
|
||||||
Refs #14753, #15785
|
Refs #14753, #15785
|
||||||
"""
|
"""
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
|
|
||||||
def test_body_from_empty_request(self):
|
def test_body_from_empty_request(self):
|
||||||
"""HttpRequest.body on a test client GET request should return
|
"""HttpRequest.body on a test client GET request should return
|
||||||
|
@ -1391,6 +1391,7 @@ class ReadLimitedStreamTest(TestCase):
|
||||||
content_type='text/plain').content, payload)
|
content_type='text/plain').content, payload)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls')
|
||||||
class RequestFactoryStateTest(TestCase):
|
class RequestFactoryStateTest(TestCase):
|
||||||
"""Regression tests for #15929."""
|
"""Regression tests for #15929."""
|
||||||
# These tests are checking that certain middleware don't change certain
|
# These tests are checking that certain middleware don't change certain
|
||||||
|
@ -1398,7 +1399,6 @@ class RequestFactoryStateTest(TestCase):
|
||||||
# ensuring test isolation behavior. So, unusually, it doesn't make sense to
|
# ensuring test isolation behavior. So, unusually, it doesn't make sense to
|
||||||
# run the tests individually, and if any are failing it is confusing to run
|
# run the tests individually, and if any are failing it is confusing to run
|
||||||
# them with any other set of tests.
|
# them with any other set of tests.
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
|
|
||||||
def common_test_that_should_always_pass(self):
|
def common_test_that_should_always_pass(self):
|
||||||
request = RequestFactory().get('/')
|
request = RequestFactory().get('/')
|
||||||
|
@ -1418,12 +1418,12 @@ class RequestFactoryStateTest(TestCase):
|
||||||
self.common_test_that_should_always_pass()
|
self.common_test_that_should_always_pass()
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_client_regress.urls')
|
||||||
class RequestFactoryEnvironmentTests(TestCase):
|
class RequestFactoryEnvironmentTests(TestCase):
|
||||||
"""
|
"""
|
||||||
Regression tests for #8551 and #17067: ensure that environment variables
|
Regression tests for #8551 and #17067: ensure that environment variables
|
||||||
are set correctly in RequestFactory.
|
are set correctly in RequestFactory.
|
||||||
"""
|
"""
|
||||||
urls = 'test_client_regress.urls'
|
|
||||||
|
|
||||||
def test_should_set_correct_env_variables(self):
|
def test_should_set_correct_env_variables(self):
|
||||||
request = RequestFactory().get('/path/')
|
request = RequestFactory().get('/path/')
|
||||||
|
|
|
@ -51,8 +51,8 @@ class SkippingClassTestCase(TestCase):
|
||||||
self.assertEqual(len(result.skipped), 1)
|
self.assertEqual(len(result.skipped), 1)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_utils.urls')
|
||||||
class AssertNumQueriesTests(TestCase):
|
class AssertNumQueriesTests(TestCase):
|
||||||
urls = 'test_utils.urls'
|
|
||||||
|
|
||||||
def test_assert_num_queries(self):
|
def test_assert_num_queries(self):
|
||||||
def test_func():
|
def test_func():
|
||||||
|
@ -121,8 +121,8 @@ class AssertQuerysetEqualTests(TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_utils.urls')
|
||||||
class CaptureQueriesContextManagerTests(TestCase):
|
class CaptureQueriesContextManagerTests(TestCase):
|
||||||
urls = 'test_utils.urls'
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.person_pk = six.text_type(Person.objects.create(name='test').pk)
|
self.person_pk = six.text_type(Person.objects.create(name='test').pk)
|
||||||
|
@ -175,8 +175,8 @@ class CaptureQueriesContextManagerTests(TestCase):
|
||||||
self.assertIn(self.person_pk, captured_queries[1]['sql'])
|
self.assertIn(self.person_pk, captured_queries[1]['sql'])
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_utils.urls')
|
||||||
class AssertNumQueriesContextManagerTests(TestCase):
|
class AssertNumQueriesContextManagerTests(TestCase):
|
||||||
urls = 'test_utils.urls'
|
|
||||||
|
|
||||||
def test_simple(self):
|
def test_simple(self):
|
||||||
with self.assertNumQueries(0):
|
with self.assertNumQueries(0):
|
||||||
|
@ -214,8 +214,8 @@ class AssertNumQueriesContextManagerTests(TestCase):
|
||||||
self.client.get("/test_utils/get_person/%s/" % person.pk)
|
self.client.get("/test_utils/get_person/%s/" % person.pk)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='test_utils.urls')
|
||||||
class AssertTemplateUsedContextManagerTests(TestCase):
|
class AssertTemplateUsedContextManagerTests(TestCase):
|
||||||
urls = 'test_utils.urls'
|
|
||||||
|
|
||||||
def test_usage(self):
|
def test_usage(self):
|
||||||
with self.assertTemplateUsed('template_used/base.html'):
|
with self.assertTemplateUsed('template_used/base.html'):
|
||||||
|
|
|
@ -1070,10 +1070,10 @@ class NewFormsTests(TestCase):
|
||||||
|
|
||||||
|
|
||||||
@override_settings(DATETIME_FORMAT='c', TIME_ZONE='Africa/Nairobi', USE_L10N=False, USE_TZ=True,
|
@override_settings(DATETIME_FORMAT='c', TIME_ZONE='Africa/Nairobi', USE_L10N=False, USE_TZ=True,
|
||||||
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
|
ROOT_URLCONF='timezones.urls')
|
||||||
class AdminTests(TestCase):
|
class AdminTests(TestCase):
|
||||||
|
|
||||||
urls = 'timezones.urls'
|
|
||||||
fixtures = ['tz_users.xml']
|
fixtures = ['tz_users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
|
@ -6,6 +6,7 @@ from __future__ import unicode_literals
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
from django.conf import settings
|
||||||
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
|
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
|
||||||
from django.core.urlresolvers import (reverse, reverse_lazy, resolve, get_callable,
|
from django.core.urlresolvers import (reverse, reverse_lazy, resolve, get_callable,
|
||||||
get_resolver, NoReverseMatch, Resolver404, ResolverMatch, RegexURLResolver,
|
get_resolver, NoReverseMatch, Resolver404, ResolverMatch, RegexURLResolver,
|
||||||
|
@ -152,14 +153,14 @@ test_data = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='urlpatterns_reverse.no_urls')
|
||||||
class NoURLPatternsTests(TestCase):
|
class NoURLPatternsTests(TestCase):
|
||||||
urls = 'urlpatterns_reverse.no_urls'
|
|
||||||
|
|
||||||
def test_no_urls_exception(self):
|
def test_no_urls_exception(self):
|
||||||
"""
|
"""
|
||||||
RegexURLResolver should raise an exception when no urlpatterns exist.
|
RegexURLResolver should raise an exception when no urlpatterns exist.
|
||||||
"""
|
"""
|
||||||
resolver = RegexURLResolver(r'^$', self.urls)
|
resolver = RegexURLResolver(r'^$', settings.ROOT_URLCONF)
|
||||||
|
|
||||||
self.assertRaisesMessage(ImproperlyConfigured,
|
self.assertRaisesMessage(ImproperlyConfigured,
|
||||||
"The included urlconf 'urlpatterns_reverse.no_urls' does not "
|
"The included urlconf 'urlpatterns_reverse.no_urls' does not "
|
||||||
|
@ -168,8 +169,8 @@ class NoURLPatternsTests(TestCase):
|
||||||
getattr, resolver, 'url_patterns')
|
getattr, resolver, 'url_patterns')
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='urlpatterns_reverse.urls')
|
||||||
class URLPatternReverse(TestCase):
|
class URLPatternReverse(TestCase):
|
||||||
urls = 'urlpatterns_reverse.urls'
|
|
||||||
|
|
||||||
def test_urlpattern_reverse(self):
|
def test_urlpattern_reverse(self):
|
||||||
for name, expected, args, kwargs in test_data:
|
for name, expected, args, kwargs in test_data:
|
||||||
|
@ -290,8 +291,8 @@ class ResolverTests(unittest.TestCase):
|
||||||
self.assertEqual(t.name, e['name'], 'Wrong URL name. Expected "%s", got "%s".' % (e['name'], t.name))
|
self.assertEqual(t.name, e['name'], 'Wrong URL name. Expected "%s", got "%s".' % (e['name'], t.name))
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='urlpatterns_reverse.reverse_lazy_urls')
|
||||||
class ReverseLazyTest(TestCase):
|
class ReverseLazyTest(TestCase):
|
||||||
urls = 'urlpatterns_reverse.reverse_lazy_urls'
|
|
||||||
|
|
||||||
def test_redirect_with_lazy_reverse(self):
|
def test_redirect_with_lazy_reverse(self):
|
||||||
response = self.client.get('/redirect/')
|
response = self.client.get('/redirect/')
|
||||||
|
@ -324,8 +325,8 @@ LOGIN_URL = reverse_lazy('login')""")
|
||||||
self.assertNoOutput(err)
|
self.assertNoOutput(err)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='urlpatterns_reverse.urls')
|
||||||
class ReverseShortcutTests(TestCase):
|
class ReverseShortcutTests(TestCase):
|
||||||
urls = 'urlpatterns_reverse.urls'
|
|
||||||
|
|
||||||
def test_redirect_to_object(self):
|
def test_redirect_to_object(self):
|
||||||
# We don't really need a model; just something with a get_absolute_url
|
# We don't really need a model; just something with a get_absolute_url
|
||||||
|
@ -363,8 +364,8 @@ class ReverseShortcutTests(TestCase):
|
||||||
self.assertRaises(NoReverseMatch, redirect, absolute_kwargs_view, wrong_argument=None)
|
self.assertRaises(NoReverseMatch, redirect, absolute_kwargs_view, wrong_argument=None)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='urlpatterns_reverse.namespace_urls')
|
||||||
class NamespaceTests(TestCase):
|
class NamespaceTests(TestCase):
|
||||||
urls = 'urlpatterns_reverse.namespace_urls'
|
|
||||||
|
|
||||||
def test_ambiguous_object(self):
|
def test_ambiguous_object(self):
|
||||||
"Names deployed via dynamic URL objects that require namespaces can't be resolved"
|
"Names deployed via dynamic URL objects that require namespaces can't be resolved"
|
||||||
|
@ -600,8 +601,8 @@ class ErrorHandlerResolutionTests(TestCase):
|
||||||
self.assertEqual(self.callable_resolver.resolve500(), handler)
|
self.assertEqual(self.callable_resolver.resolve500(), handler)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='urlpatterns_reverse.urls_without_full_import')
|
||||||
class DefaultErrorHandlerTests(TestCase):
|
class DefaultErrorHandlerTests(TestCase):
|
||||||
urls = 'urlpatterns_reverse.urls_without_full_import'
|
|
||||||
|
|
||||||
def test_default_handler(self):
|
def test_default_handler(self):
|
||||||
"If the urls.py doesn't specify handlers, the defaults are used"
|
"If the urls.py doesn't specify handlers, the defaults are used"
|
||||||
|
@ -617,16 +618,16 @@ class DefaultErrorHandlerTests(TestCase):
|
||||||
self.fail("Shouldn't get an AttributeError due to undefined 500 handler")
|
self.fail("Shouldn't get an AttributeError due to undefined 500 handler")
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF=None)
|
||||||
class NoRootUrlConfTests(TestCase):
|
class NoRootUrlConfTests(TestCase):
|
||||||
"""Tests for handler404 and handler500 if urlconf is None"""
|
"""Tests for handler404 and handler500 if urlconf is None"""
|
||||||
urls = None
|
|
||||||
|
|
||||||
def test_no_handler_exception(self):
|
def test_no_handler_exception(self):
|
||||||
self.assertRaises(ImproperlyConfigured, self.client.get, '/test/me/')
|
self.assertRaises(ImproperlyConfigured, self.client.get, '/test/me/')
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='urlpatterns_reverse.namespace_urls')
|
||||||
class ResolverMatchTests(TestCase):
|
class ResolverMatchTests(TestCase):
|
||||||
urls = 'urlpatterns_reverse.namespace_urls'
|
|
||||||
|
|
||||||
def test_urlpattern_resolve(self):
|
def test_urlpattern_resolve(self):
|
||||||
for path, name, app_name, namespace, func, args, kwargs in resolve_test_data:
|
for path, name, app_name, namespace, func, args, kwargs in resolve_test_data:
|
||||||
|
@ -661,8 +662,8 @@ class ResolverMatchTests(TestCase):
|
||||||
self.assertIsNone(request.resolver_match)
|
self.assertIsNone(request.resolver_match)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='urlpatterns_reverse.erroneous_urls')
|
||||||
class ErroneousViewTests(TestCase):
|
class ErroneousViewTests(TestCase):
|
||||||
urls = 'urlpatterns_reverse.erroneous_urls'
|
|
||||||
|
|
||||||
def test_erroneous_resolve(self):
|
def test_erroneous_resolve(self):
|
||||||
self.assertRaises(ImportError, self.client.get, '/erroneous_inner/')
|
self.assertRaises(ImportError, self.client.get, '/erroneous_inner/')
|
||||||
|
|
|
@ -2,8 +2,8 @@ from django.test import TestCase, override_settings, Client
|
||||||
from django.utils.translation import override
|
from django.utils.translation import override
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF="view_tests.urls")
|
||||||
class CsrfViewTests(TestCase):
|
class CsrfViewTests(TestCase):
|
||||||
urls = "view_tests.urls"
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(CsrfViewTests, self).setUp()
|
super(CsrfViewTests, self).setUp()
|
||||||
|
|
|
@ -30,9 +30,9 @@ from ..views import (sensitive_view, non_sensitive_view, paranoid_view,
|
||||||
multivalue_dict_key_error)
|
multivalue_dict_key_error)
|
||||||
|
|
||||||
|
|
||||||
@override_settings(DEBUG=True, TEMPLATE_DEBUG=True)
|
@override_settings(DEBUG=True, TEMPLATE_DEBUG=True,
|
||||||
|
ROOT_URLCONF="view_tests.urls")
|
||||||
class DebugViewTests(TestCase):
|
class DebugViewTests(TestCase):
|
||||||
urls = "view_tests.urls"
|
|
||||||
|
|
||||||
def test_files(self):
|
def test_files(self):
|
||||||
response = self.client.get('/raises/')
|
response = self.client.get('/raises/')
|
||||||
|
@ -521,12 +521,12 @@ class ExceptionReportTestMixin(object):
|
||||||
self.assertNotIn(v, body)
|
self.assertNotIn(v, body)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='view_tests.urls')
|
||||||
class ExceptionReporterFilterTests(TestCase, ExceptionReportTestMixin):
|
class ExceptionReporterFilterTests(TestCase, ExceptionReportTestMixin):
|
||||||
"""
|
"""
|
||||||
Ensure that sensitive information can be filtered out of error reports.
|
Ensure that sensitive information can be filtered out of error reports.
|
||||||
Refs #14614.
|
Refs #14614.
|
||||||
"""
|
"""
|
||||||
urls = 'view_tests.urls'
|
|
||||||
rf = RequestFactory()
|
rf = RequestFactory()
|
||||||
|
|
||||||
def test_non_sensitive_request(self):
|
def test_non_sensitive_request(self):
|
||||||
|
|
|
@ -7,9 +7,9 @@ from django.test.utils import (setup_test_template_loader,
|
||||||
from ..models import UrlArticle
|
from ..models import UrlArticle
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='view_tests.urls')
|
||||||
class DefaultsTests(TestCase):
|
class DefaultsTests(TestCase):
|
||||||
"""Test django views in django/views/defaults.py"""
|
"""Test django views in django/views/defaults.py"""
|
||||||
urls = 'view_tests.urls'
|
|
||||||
fixtures = ['testdata.json']
|
fixtures = ['testdata.json']
|
||||||
non_existing_urls = ['/non_existing_url/', # this is in urls.py
|
non_existing_urls = ['/non_existing_url/', # this is in urls.py
|
||||||
'/other_non_existing_url/'] # this NOT in urls.py
|
'/other_non_existing_url/'] # this NOT in urls.py
|
||||||
|
|
|
@ -17,9 +17,9 @@ from django.utils.translation import override, LANGUAGE_SESSION_KEY
|
||||||
from ..urls import locale_dir
|
from ..urls import locale_dir
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='view_tests.urls')
|
||||||
class I18NTests(TestCase):
|
class I18NTests(TestCase):
|
||||||
""" Tests django views in django/views/i18n.py """
|
""" Tests django views in django/views/i18n.py """
|
||||||
urls = 'view_tests.urls'
|
|
||||||
|
|
||||||
def test_setlang(self):
|
def test_setlang(self):
|
||||||
"""
|
"""
|
||||||
|
@ -85,12 +85,12 @@ class I18NTests(TestCase):
|
||||||
self.assertContains(response, r'"month name\u0004May": "mai"', 1)
|
self.assertContains(response, r'"month name\u0004May": "mai"', 1)
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='view_tests.urls')
|
||||||
class JsI18NTests(TestCase):
|
class JsI18NTests(TestCase):
|
||||||
"""
|
"""
|
||||||
Tests django views in django/views/i18n.py that need to change
|
Tests django views in django/views/i18n.py that need to change
|
||||||
settings.LANGUAGE_CODE.
|
settings.LANGUAGE_CODE.
|
||||||
"""
|
"""
|
||||||
urls = 'view_tests.urls'
|
|
||||||
|
|
||||||
def test_jsi18n_with_missing_en_files(self):
|
def test_jsi18n_with_missing_en_files(self):
|
||||||
"""
|
"""
|
||||||
|
@ -163,8 +163,8 @@ class JsI18NTests(TestCase):
|
||||||
self.assertContains(response, '\\ud83d\\udca9')
|
self.assertContains(response, '\\ud83d\\udca9')
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='view_tests.urls')
|
||||||
class JsI18NTestsMultiPackage(TestCase):
|
class JsI18NTestsMultiPackage(TestCase):
|
||||||
urls = 'view_tests.urls'
|
|
||||||
"""
|
"""
|
||||||
Tests for django views in django/views/i18n.py that need to change
|
Tests for django views in django/views/i18n.py that need to change
|
||||||
settings.LANGUAGE_CODE and merge JS translation from several packages.
|
settings.LANGUAGE_CODE and merge JS translation from several packages.
|
||||||
|
@ -207,11 +207,11 @@ skip_selenium = not os.environ.get('DJANGO_SELENIUM_TESTS', False)
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(skip_selenium, 'Selenium tests not requested')
|
@unittest.skipIf(skip_selenium, 'Selenium tests not requested')
|
||||||
|
@override_settings(ROOT_URLCONF='view_tests.urls')
|
||||||
class JavascriptI18nTests(LiveServerTestCase):
|
class JavascriptI18nTests(LiveServerTestCase):
|
||||||
|
|
||||||
# The test cases use translations from these apps.
|
# The test cases use translations from these apps.
|
||||||
available_apps = ['django.contrib.admin', 'view_tests']
|
available_apps = ['django.contrib.admin', 'view_tests']
|
||||||
urls = 'view_tests.urls'
|
|
||||||
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -3,11 +3,11 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='view_tests.generic_urls')
|
||||||
class JsonResponseTests(TestCase):
|
class JsonResponseTests(TestCase):
|
||||||
urls = 'view_tests.generic_urls'
|
|
||||||
|
|
||||||
def test_json_response(self):
|
def test_json_response(self):
|
||||||
response = self.client.get('/json/response/')
|
response = self.client.get('/json/response/')
|
||||||
|
|
|
@ -4,9 +4,9 @@ from django.test import TestCase, override_settings
|
||||||
@override_settings(
|
@override_settings(
|
||||||
TEMPLATE_CONTEXT_PROCESSORS=('django.core.context_processors.static',),
|
TEMPLATE_CONTEXT_PROCESSORS=('django.core.context_processors.static',),
|
||||||
STATIC_URL='/path/to/static/media/',
|
STATIC_URL='/path/to/static/media/',
|
||||||
|
ROOT_URLCONF='view_tests.generic_urls',
|
||||||
)
|
)
|
||||||
class ShortcutTests(TestCase):
|
class ShortcutTests(TestCase):
|
||||||
urls = 'view_tests.generic_urls'
|
|
||||||
|
|
||||||
def test_render_to_response(self):
|
def test_render_to_response(self):
|
||||||
response = self.client.get('/shortcuts/render_to_response/')
|
response = self.client.get('/shortcuts/render_to_response/')
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase, override_settings
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF='view_tests.generic_urls')
|
||||||
class URLHandling(TestCase):
|
class URLHandling(TestCase):
|
||||||
"""
|
"""
|
||||||
Tests for URL handling in views and responses.
|
Tests for URL handling in views and responses.
|
||||||
"""
|
"""
|
||||||
urls = 'view_tests.generic_urls'
|
|
||||||
redirect_target = "/%E4%B8%AD%E6%96%87/target/"
|
redirect_target = "/%E4%B8%AD%E6%96%87/target/"
|
||||||
|
|
||||||
def test_combining_redirect(self):
|
def test_combining_redirect(self):
|
||||||
|
|
|
@ -14,11 +14,10 @@ from .. import urls
|
||||||
from ..urls import media_dir
|
from ..urls import media_dir
|
||||||
|
|
||||||
|
|
||||||
@override_settings(DEBUG=True)
|
@override_settings(DEBUG=True, ROOT_URLCONF='view_tests.urls')
|
||||||
class StaticTests(SimpleTestCase):
|
class StaticTests(SimpleTestCase):
|
||||||
"""Tests django views in django/views/static.py"""
|
"""Tests django views in django/views/static.py"""
|
||||||
|
|
||||||
urls = 'view_tests.urls'
|
|
||||||
prefix = 'site_media'
|
prefix = 'site_media'
|
||||||
|
|
||||||
def test_serve(self):
|
def test_serve(self):
|
||||||
|
|
|
@ -12,8 +12,8 @@ from django.test.client import RequestFactory
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(ROOT_URLCONF="wsgi.urls")
|
||||||
class WSGITest(TestCase):
|
class WSGITest(TestCase):
|
||||||
urls = "wsgi.urls"
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
request_started.disconnect(close_old_connections)
|
request_started.disconnect(close_old_connections)
|
||||||
|
|
Loading…
Reference in New Issue