Renamed some tests and removed references to modeltests/regressiontests.

This commit is contained in:
Florian Apolloner 2013-02-26 13:19:18 +01:00
parent 737a5d71f0
commit 33836cf88d
224 changed files with 384 additions and 376 deletions

View File

@ -24,7 +24,7 @@ from .models import (Event, Child, Parent, Genre, Band, Musician, Group,
class ChangeListTests(TestCase): class ChangeListTests(TestCase):
urls = "regressiontests.admin_changelist.urls" urls = "admin_changelist.urls"
def setUp(self): def setUp(self):
self.factory = RequestFactory() self.factory = RequestFactory()

View File

@ -17,7 +17,7 @@ from .models import (Holder, Inner, Holder2, Inner2, Holder3, Inner3, Person,
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class TestInline(TestCase): class TestInline(TestCase):
urls = "regressiontests.admin_inlines.urls" urls = "admin_inlines.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -196,7 +196,7 @@ class TestInline(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class TestInlineMedia(TestCase): class TestInlineMedia(TestCase):
urls = "regressiontests.admin_inlines.urls" urls = "admin_inlines.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -233,7 +233,7 @@ class TestInlineMedia(TestCase):
self.assertContains(response, 'my_awesome_inline_scripts.js') self.assertContains(response, 'my_awesome_inline_scripts.js')
class TestInlineAdminForm(TestCase): class TestInlineAdminForm(TestCase):
urls = "regressiontests.admin_inlines.urls" urls = "admin_inlines.urls"
def test_immutable_content_type(self): def test_immutable_content_type(self):
"""Regression for #9362 """Regression for #9362
@ -256,7 +256,7 @@ class TestInlinePermissions(TestCase):
inline. Refs #8060. inline. Refs #8060.
""" """
urls = "regressiontests.admin_inlines.urls" urls = "admin_inlines.urls"
def setUp(self): def setUp(self):
self.user = User(username='admin') self.user = User(username='admin')
@ -451,7 +451,7 @@ class TestInlinePermissions(TestCase):
class SeleniumFirefoxTests(AdminSeleniumWebDriverTestCase): class SeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver' webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
urls = "regressiontests.admin_inlines.urls" urls = "admin_inlines.urls"
def test_add_stackeds(self): def test_add_stackeds(self):
""" """

View File

@ -25,11 +25,17 @@ from django.utils._os import upath
from django.utils.six import StringIO from django.utils.six import StringIO
from django.test import LiveServerTestCase from django.test import LiveServerTestCase
test_dir = os.path.dirname(os.path.dirname(upath(__file__)))
test_dir = os.path.join(os.environ['DJANGO_TEST_TEMP_DIR'], 'test_project')
if not os.path.exists(test_dir):
os.mkdir(test_dir)
open(os.path.join(test_dir, '__init__.py'), 'w').close()
custom_templates_dir = os.path.join(os.path.dirname(__file__), 'custom_templates')
class AdminScriptTestCase(unittest.TestCase): class AdminScriptTestCase(unittest.TestCase):
def write_settings(self, filename, apps=None, is_dir=False, sdict=None): def write_settings(self, filename, apps=None, is_dir=False, sdict=None):
test_dir = os.path.dirname(os.path.dirname(upath(__file__)))
if is_dir: if is_dir:
settings_dir = os.path.join(test_dir, filename) settings_dir = os.path.join(test_dir, filename)
os.mkdir(settings_dir) os.mkdir(settings_dir)
@ -38,7 +44,7 @@ class AdminScriptTestCase(unittest.TestCase):
settings_file_path = os.path.join(test_dir, filename) settings_file_path = os.path.join(test_dir, filename)
with open(settings_file_path, 'w') as settings_file: with open(settings_file_path, 'w') as settings_file:
settings_file.write('# Settings file automatically generated by regressiontests.admin_scripts test case\n') settings_file.write('# Settings file automatically generated by admin_scripts test case\n')
exports = [ exports = [
'DATABASES', 'DATABASES',
'ROOT_URLCONF', 'ROOT_URLCONF',
@ -52,7 +58,7 @@ class AdminScriptTestCase(unittest.TestCase):
settings_file.write("%s = %s\n" % (s, o)) settings_file.write("%s = %s\n" % (s, o))
if apps is None: if apps is None:
apps = ['django.contrib.auth', 'django.contrib.contenttypes', 'regressiontests.admin_scripts'] apps = ['django.contrib.auth', 'django.contrib.contenttypes', 'admin_scripts']
settings_file.write("INSTALLED_APPS = %s\n" % apps) settings_file.write("INSTALLED_APPS = %s\n" % apps)
@ -91,16 +97,18 @@ class AdminScriptTestCase(unittest.TestCase):
first_package_re = re.compile(r'(^[^\.]+)\.') first_package_re = re.compile(r'(^[^\.]+)\.')
for backend in settings.DATABASES.values(): for backend in settings.DATABASES.values():
result = first_package_re.findall(backend['ENGINE']) result = first_package_re.findall(backend['ENGINE'])
if result and result != 'django': if result and result != ['django']:
backend_pkg = __import__(result[0]) backend_pkg = __import__(result[0])
backend_dir = os.path.dirname(backend_pkg.__file__) backend_dir = os.path.dirname(backend_pkg.__file__)
paths.append(os.path.dirname(backend_dir)) paths.append(os.path.dirname(backend_dir))
return paths return paths
def run_test(self, script, args, settings_file=None, apps=None): def run_test(self, script, args, settings_file=None, apps=None):
test_dir = os.path.dirname(os.path.dirname(__file__)) project_dir = test_dir
project_dir = os.path.dirname(test_dir)
base_dir = os.path.dirname(project_dir) base_dir = os.path.dirname(project_dir)
import django
django_dir = os.path.dirname(os.path.dirname(django.__file__))
tests_dir = os.path.join(django_dir, 'tests')
ext_backend_base_dirs = self._ext_backend_paths() ext_backend_base_dirs = self._ext_backend_paths()
# Remember the old environment # Remember the old environment
@ -118,7 +126,7 @@ class AdminScriptTestCase(unittest.TestCase):
os.environ['DJANGO_SETTINGS_MODULE'] = settings_file os.environ['DJANGO_SETTINGS_MODULE'] = settings_file
elif 'DJANGO_SETTINGS_MODULE' in os.environ: elif 'DJANGO_SETTINGS_MODULE' in os.environ:
del os.environ['DJANGO_SETTINGS_MODULE'] del os.environ['DJANGO_SETTINGS_MODULE']
python_path = [project_dir, base_dir] python_path = [project_dir, base_dir, django_dir, tests_dir]
python_path.extend(ext_backend_base_dirs) python_path.extend(ext_backend_base_dirs)
os.environ[python_path_var_name] = os.pathsep.join(python_path) os.environ[python_path_var_name] = os.pathsep.join(python_path)
@ -127,7 +135,6 @@ class AdminScriptTestCase(unittest.TestCase):
out, err = subprocess.Popen([sys.executable, script] + args, out, err = subprocess.Popen([sys.executable, script] + args,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
universal_newlines=True).communicate() universal_newlines=True).communicate()
# Restore the old environment # Restore the old environment
if old_django_settings_module: if old_django_settings_module:
os.environ['DJANGO_SETTINGS_MODULE'] = old_django_settings_module os.environ['DJANGO_SETTINGS_MODULE'] = old_django_settings_module
@ -158,7 +165,7 @@ class AdminScriptTestCase(unittest.TestCase):
with open(test_manage_py, 'r') as fp: with open(test_manage_py, 'r') as fp:
manage_py_contents = fp.read() manage_py_contents = fp.read()
manage_py_contents = manage_py_contents.replace( manage_py_contents = manage_py_contents.replace(
"{{ project_name }}", "regressiontests") "{{ project_name }}", "test_project")
with open(test_manage_py, 'w') as fp: with open(test_manage_py, 'w') as fp:
fp.write(manage_py_contents) fp.write(manage_py_contents)
self.addCleanup(safe_remove, test_manage_py) self.addCleanup(safe_remove, test_manage_py)
@ -230,7 +237,7 @@ class DjangoAdminDefaultSettings(AdminScriptTestCase):
def test_builtin_with_settings(self): def test_builtin_with_settings(self):
"default: django-admin builtin commands succeed if settings are provided as argument" "default: django-admin builtin commands succeed if settings are provided as argument"
args = ['sqlall', '--settings=regressiontests.settings', 'admin_scripts'] args = ['sqlall', '--settings=test_project.settings', 'admin_scripts']
out, err = self.run_django_admin(args) out, err = self.run_django_admin(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -238,7 +245,7 @@ class DjangoAdminDefaultSettings(AdminScriptTestCase):
def test_builtin_with_environment(self): def test_builtin_with_environment(self):
"default: django-admin builtin commands succeed if settings are provided in the environment" "default: django-admin builtin commands succeed if settings are provided in the environment"
args = ['sqlall', 'admin_scripts'] args = ['sqlall', 'admin_scripts']
out, err = self.run_django_admin(args, 'regressiontests.settings') out, err = self.run_django_admin(args, 'test_project.settings')
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -265,7 +272,7 @@ class DjangoAdminDefaultSettings(AdminScriptTestCase):
def test_custom_command_with_settings(self): def test_custom_command_with_settings(self):
"default: django-admin can execute user commands if settings are provided as argument" "default: django-admin can execute user commands if settings are provided as argument"
args = ['noargs_command', '--settings=regressiontests.settings'] args = ['noargs_command', '--settings=test_project.settings']
out, err = self.run_django_admin(args) out, err = self.run_django_admin(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:NoArgsCommand") self.assertOutput(out, "EXECUTE:NoArgsCommand")
@ -273,7 +280,7 @@ class DjangoAdminDefaultSettings(AdminScriptTestCase):
def test_custom_command_with_environment(self): def test_custom_command_with_environment(self):
"default: django-admin can execute user commands if settings are provided in environment" "default: django-admin can execute user commands if settings are provided in environment"
args = ['noargs_command'] args = ['noargs_command']
out, err = self.run_django_admin(args, 'regressiontests.settings') out, err = self.run_django_admin(args, 'test_project.settings')
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:NoArgsCommand") self.assertOutput(out, "EXECUTE:NoArgsCommand")
@ -282,7 +289,7 @@ class DjangoAdminFullPathDefaultSettings(AdminScriptTestCase):
contains the test application specified using a full path. contains the test application specified using a full path.
""" """
def setUp(self): def setUp(self):
self.write_settings('settings.py', ['django.contrib.auth', 'django.contrib.contenttypes', 'regressiontests.admin_scripts']) self.write_settings('settings.py', ['django.contrib.auth', 'django.contrib.contenttypes', 'admin_scripts'])
def tearDown(self): def tearDown(self):
self.remove_settings('settings.py') self.remove_settings('settings.py')
@ -296,7 +303,7 @@ class DjangoAdminFullPathDefaultSettings(AdminScriptTestCase):
def test_builtin_with_settings(self): def test_builtin_with_settings(self):
"fulldefault: django-admin builtin commands succeed if a settings file is provided" "fulldefault: django-admin builtin commands succeed if a settings file is provided"
args = ['sqlall', '--settings=regressiontests.settings', 'admin_scripts'] args = ['sqlall', '--settings=test_project.settings', 'admin_scripts']
out, err = self.run_django_admin(args) out, err = self.run_django_admin(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -304,7 +311,7 @@ class DjangoAdminFullPathDefaultSettings(AdminScriptTestCase):
def test_builtin_with_environment(self): def test_builtin_with_environment(self):
"fulldefault: django-admin builtin commands succeed if the environment contains settings" "fulldefault: django-admin builtin commands succeed if the environment contains settings"
args = ['sqlall', 'admin_scripts'] args = ['sqlall', 'admin_scripts']
out, err = self.run_django_admin(args, 'regressiontests.settings') out, err = self.run_django_admin(args, 'test_project.settings')
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -331,7 +338,7 @@ class DjangoAdminFullPathDefaultSettings(AdminScriptTestCase):
def test_custom_command_with_settings(self): def test_custom_command_with_settings(self):
"fulldefault: django-admin can execute user commands if settings are provided as argument" "fulldefault: django-admin can execute user commands if settings are provided as argument"
args = ['noargs_command', '--settings=regressiontests.settings'] args = ['noargs_command', '--settings=test_project.settings']
out, err = self.run_django_admin(args) out, err = self.run_django_admin(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:NoArgsCommand") self.assertOutput(out, "EXECUTE:NoArgsCommand")
@ -339,7 +346,7 @@ class DjangoAdminFullPathDefaultSettings(AdminScriptTestCase):
def test_custom_command_with_environment(self): def test_custom_command_with_environment(self):
"fulldefault: django-admin can execute user commands if settings are provided in environment" "fulldefault: django-admin can execute user commands if settings are provided in environment"
args = ['noargs_command'] args = ['noargs_command']
out, err = self.run_django_admin(args, 'regressiontests.settings') out, err = self.run_django_admin(args, 'test_project.settings')
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:NoArgsCommand") self.assertOutput(out, "EXECUTE:NoArgsCommand")
@ -362,7 +369,7 @@ class DjangoAdminMinimalSettings(AdminScriptTestCase):
def test_builtin_with_settings(self): def test_builtin_with_settings(self):
"minimal: django-admin builtin commands fail if settings are provided as argument" "minimal: django-admin builtin commands fail if settings are provided as argument"
args = ['sqlall', '--settings=regressiontests.settings', 'admin_scripts'] args = ['sqlall', '--settings=test_project.settings', 'admin_scripts']
out, err = self.run_django_admin(args) out, err = self.run_django_admin(args)
self.assertNoOutput(out) self.assertNoOutput(out)
self.assertOutput(err, 'App with label admin_scripts could not be found') self.assertOutput(err, 'App with label admin_scripts could not be found')
@ -370,7 +377,7 @@ class DjangoAdminMinimalSettings(AdminScriptTestCase):
def test_builtin_with_environment(self): def test_builtin_with_environment(self):
"minimal: django-admin builtin commands fail if settings are provided in the environment" "minimal: django-admin builtin commands fail if settings are provided in the environment"
args = ['sqlall', 'admin_scripts'] args = ['sqlall', 'admin_scripts']
out, err = self.run_django_admin(args, 'regressiontests.settings') out, err = self.run_django_admin(args, 'test_project.settings')
self.assertNoOutput(out) self.assertNoOutput(out)
self.assertOutput(err, 'App with label admin_scripts could not be found') self.assertOutput(err, 'App with label admin_scripts could not be found')
@ -397,7 +404,7 @@ class DjangoAdminMinimalSettings(AdminScriptTestCase):
def test_custom_command_with_settings(self): def test_custom_command_with_settings(self):
"minimal: django-admin can't execute user commands, even if settings are provided as argument" "minimal: django-admin can't execute user commands, even if settings are provided as argument"
args = ['noargs_command', '--settings=regressiontests.settings'] args = ['noargs_command', '--settings=test_project.settings']
out, err = self.run_django_admin(args) out, err = self.run_django_admin(args)
self.assertNoOutput(out) self.assertNoOutput(out)
self.assertOutput(err, "Unknown command: 'noargs_command'") self.assertOutput(err, "Unknown command: 'noargs_command'")
@ -405,7 +412,7 @@ class DjangoAdminMinimalSettings(AdminScriptTestCase):
def test_custom_command_with_environment(self): def test_custom_command_with_environment(self):
"minimal: django-admin can't execute user commands, even if settings are provided in environment" "minimal: django-admin can't execute user commands, even if settings are provided in environment"
args = ['noargs_command'] args = ['noargs_command']
out, err = self.run_django_admin(args, 'regressiontests.settings') out, err = self.run_django_admin(args, 'test_project.settings')
self.assertNoOutput(out) self.assertNoOutput(out)
self.assertOutput(err, "Unknown command: 'noargs_command'") self.assertOutput(err, "Unknown command: 'noargs_command'")
@ -428,7 +435,7 @@ class DjangoAdminAlternateSettings(AdminScriptTestCase):
def test_builtin_with_settings(self): def test_builtin_with_settings(self):
"alternate: django-admin builtin commands succeed if settings are provided as argument" "alternate: django-admin builtin commands succeed if settings are provided as argument"
args = ['sqlall', '--settings=regressiontests.alternate_settings', 'admin_scripts'] args = ['sqlall', '--settings=test_project.alternate_settings', 'admin_scripts']
out, err = self.run_django_admin(args) out, err = self.run_django_admin(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -436,7 +443,7 @@ class DjangoAdminAlternateSettings(AdminScriptTestCase):
def test_builtin_with_environment(self): def test_builtin_with_environment(self):
"alternate: django-admin builtin commands succeed if settings are provided in the environment" "alternate: django-admin builtin commands succeed if settings are provided in the environment"
args = ['sqlall', 'admin_scripts'] args = ['sqlall', 'admin_scripts']
out, err = self.run_django_admin(args, 'regressiontests.alternate_settings') out, err = self.run_django_admin(args, 'test_project.alternate_settings')
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -463,7 +470,7 @@ class DjangoAdminAlternateSettings(AdminScriptTestCase):
def test_custom_command_with_settings(self): def test_custom_command_with_settings(self):
"alternate: django-admin can execute user commands if settings are provided as argument" "alternate: django-admin can execute user commands if settings are provided as argument"
args = ['noargs_command', '--settings=regressiontests.alternate_settings'] args = ['noargs_command', '--settings=test_project.alternate_settings']
out, err = self.run_django_admin(args) out, err = self.run_django_admin(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:NoArgsCommand") self.assertOutput(out, "EXECUTE:NoArgsCommand")
@ -471,7 +478,7 @@ class DjangoAdminAlternateSettings(AdminScriptTestCase):
def test_custom_command_with_environment(self): def test_custom_command_with_environment(self):
"alternate: django-admin can execute user commands if settings are provided in environment" "alternate: django-admin can execute user commands if settings are provided in environment"
args = ['noargs_command'] args = ['noargs_command']
out, err = self.run_django_admin(args, 'regressiontests.alternate_settings') out, err = self.run_django_admin(args, 'test_project.alternate_settings')
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:NoArgsCommand") self.assertOutput(out, "EXECUTE:NoArgsCommand")
@ -499,7 +506,7 @@ class DjangoAdminMultipleSettings(AdminScriptTestCase):
def test_builtin_with_settings(self): def test_builtin_with_settings(self):
"alternate: django-admin builtin commands succeed if settings are provided as argument" "alternate: django-admin builtin commands succeed if settings are provided as argument"
args = ['sqlall', '--settings=regressiontests.alternate_settings', 'admin_scripts'] args = ['sqlall', '--settings=test_project.alternate_settings', 'admin_scripts']
out, err = self.run_django_admin(args) out, err = self.run_django_admin(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -507,7 +514,7 @@ class DjangoAdminMultipleSettings(AdminScriptTestCase):
def test_builtin_with_environment(self): def test_builtin_with_environment(self):
"alternate: django-admin builtin commands succeed if settings are provided in the environment" "alternate: django-admin builtin commands succeed if settings are provided in the environment"
args = ['sqlall', 'admin_scripts'] args = ['sqlall', 'admin_scripts']
out, err = self.run_django_admin(args, 'regressiontests.alternate_settings') out, err = self.run_django_admin(args, 'test_project.alternate_settings')
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -533,7 +540,7 @@ class DjangoAdminMultipleSettings(AdminScriptTestCase):
def test_custom_command_with_settings(self): def test_custom_command_with_settings(self):
"alternate: django-admin can execute user commands if settings are provided as argument" "alternate: django-admin can execute user commands if settings are provided as argument"
args = ['noargs_command', '--settings=regressiontests.alternate_settings'] args = ['noargs_command', '--settings=test_project.alternate_settings']
out, err = self.run_django_admin(args) out, err = self.run_django_admin(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:NoArgsCommand") self.assertOutput(out, "EXECUTE:NoArgsCommand")
@ -541,7 +548,7 @@ class DjangoAdminMultipleSettings(AdminScriptTestCase):
def test_custom_command_with_environment(self): def test_custom_command_with_environment(self):
"alternate: django-admin can execute user commands if settings are provided in environment" "alternate: django-admin can execute user commands if settings are provided in environment"
args = ['noargs_command'] args = ['noargs_command']
out, err = self.run_django_admin(args, 'regressiontests.alternate_settings') out, err = self.run_django_admin(args, 'test_project.alternate_settings')
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:NoArgsCommand") self.assertOutput(out, "EXECUTE:NoArgsCommand")
@ -562,17 +569,17 @@ class DjangoAdminSettingsDirectory(AdminScriptTestCase):
"directory: startapp creates the correct directory" "directory: startapp creates the correct directory"
args = ['startapp', 'settings_test'] args = ['startapp', 'settings_test']
app_path = os.path.join(test_dir, 'settings_test') app_path = os.path.join(test_dir, 'settings_test')
out, err = self.run_django_admin(args, 'regressiontests.settings') out, err = self.run_django_admin(args, 'test_project.settings')
self.addCleanup(shutil.rmtree, app_path) self.addCleanup(shutil.rmtree, app_path)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertTrue(os.path.exists(app_path)) self.assertTrue(os.path.exists(app_path))
def test_setup_environ_custom_template(self): def test_setup_environ_custom_template(self):
"directory: startapp creates the correct directory with a custom template" "directory: startapp creates the correct directory with a custom template"
template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'app_template') template_path = os.path.join(custom_templates_dir, 'app_template')
args = ['startapp', '--template', template_path, 'custom_settings_test'] args = ['startapp', '--template', template_path, 'custom_settings_test']
app_path = os.path.join(test_dir, 'custom_settings_test') app_path = os.path.join(test_dir, 'custom_settings_test')
out, err = self.run_django_admin(args, 'regressiontests.settings') out, err = self.run_django_admin(args, 'test_project.settings')
self.addCleanup(shutil.rmtree, app_path) self.addCleanup(shutil.rmtree, app_path)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertTrue(os.path.exists(app_path)) self.assertTrue(os.path.exists(app_path))
@ -607,7 +614,7 @@ class DjangoAdminSettingsDirectory(AdminScriptTestCase):
def test_builtin_with_settings(self): def test_builtin_with_settings(self):
"directory: django-admin builtin commands succeed if settings are provided as argument" "directory: django-admin builtin commands succeed if settings are provided as argument"
args = ['sqlall', '--settings=regressiontests.settings', 'admin_scripts'] args = ['sqlall', '--settings=test_project.settings', 'admin_scripts']
out, err = self.run_django_admin(args) out, err = self.run_django_admin(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -615,7 +622,7 @@ class DjangoAdminSettingsDirectory(AdminScriptTestCase):
def test_builtin_with_environment(self): def test_builtin_with_environment(self):
"directory: django-admin builtin commands succeed if settings are provided in the environment" "directory: django-admin builtin commands succeed if settings are provided in the environment"
args = ['sqlall', 'admin_scripts'] args = ['sqlall', 'admin_scripts']
out, err = self.run_django_admin(args, 'regressiontests.settings') out, err = self.run_django_admin(args, 'test_project.settings')
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -634,7 +641,7 @@ class ManageNoSettings(AdminScriptTestCase):
args = ['sqlall', 'admin_scripts'] args = ['sqlall', 'admin_scripts']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(out) self.assertNoOutput(out)
self.assertOutput(err, "Could not import settings 'regressiontests.settings'") self.assertOutput(err, "Could not import settings 'test_project.settings'")
def test_builtin_with_bad_settings(self): def test_builtin_with_bad_settings(self):
"no settings: manage.py builtin commands fail if settings file (from argument) doesn't exist" "no settings: manage.py builtin commands fail if settings file (from argument) doesn't exist"
@ -670,7 +677,7 @@ class ManageDefaultSettings(AdminScriptTestCase):
def test_builtin_with_settings(self): def test_builtin_with_settings(self):
"default: manage.py builtin commands succeed if settings are provided as argument" "default: manage.py builtin commands succeed if settings are provided as argument"
args = ['sqlall', '--settings=regressiontests.settings', 'admin_scripts'] args = ['sqlall', '--settings=test_project.settings', 'admin_scripts']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -678,7 +685,7 @@ class ManageDefaultSettings(AdminScriptTestCase):
def test_builtin_with_environment(self): def test_builtin_with_environment(self):
"default: manage.py builtin commands succeed if settings are provided in the environment" "default: manage.py builtin commands succeed if settings are provided in the environment"
args = ['sqlall', 'admin_scripts'] args = ['sqlall', 'admin_scripts']
out, err = self.run_manage(args, 'regressiontests.settings') out, err = self.run_manage(args, 'test_project.settings')
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -705,7 +712,7 @@ class ManageDefaultSettings(AdminScriptTestCase):
def test_custom_command_with_settings(self): def test_custom_command_with_settings(self):
"default: manage.py can execute user commands when settings are provided as argument" "default: manage.py can execute user commands when settings are provided as argument"
args = ['noargs_command', '--settings=regressiontests.settings'] args = ['noargs_command', '--settings=test_project.settings']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:NoArgsCommand") self.assertOutput(out, "EXECUTE:NoArgsCommand")
@ -713,7 +720,7 @@ class ManageDefaultSettings(AdminScriptTestCase):
def test_custom_command_with_environment(self): def test_custom_command_with_environment(self):
"default: manage.py can execute user commands when settings are provided in environment" "default: manage.py can execute user commands when settings are provided in environment"
args = ['noargs_command'] args = ['noargs_command']
out, err = self.run_manage(args, 'regressiontests.settings') out, err = self.run_manage(args, 'test_project.settings')
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:NoArgsCommand") self.assertOutput(out, "EXECUTE:NoArgsCommand")
@ -723,7 +730,7 @@ class ManageFullPathDefaultSettings(AdminScriptTestCase):
contains the test application specified using a full path. contains the test application specified using a full path.
""" """
def setUp(self): def setUp(self):
self.write_settings('settings.py', ['django.contrib.auth', 'django.contrib.contenttypes', 'regressiontests.admin_scripts']) self.write_settings('settings.py', ['django.contrib.auth', 'django.contrib.contenttypes', 'admin_scripts'])
def tearDown(self): def tearDown(self):
self.remove_settings('settings.py') self.remove_settings('settings.py')
@ -737,7 +744,7 @@ class ManageFullPathDefaultSettings(AdminScriptTestCase):
def test_builtin_with_settings(self): def test_builtin_with_settings(self):
"fulldefault: manage.py builtin commands succeed if settings are provided as argument" "fulldefault: manage.py builtin commands succeed if settings are provided as argument"
args = ['sqlall', '--settings=regressiontests.settings', 'admin_scripts'] args = ['sqlall', '--settings=test_project.settings', 'admin_scripts']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -745,7 +752,7 @@ class ManageFullPathDefaultSettings(AdminScriptTestCase):
def test_builtin_with_environment(self): def test_builtin_with_environment(self):
"fulldefault: manage.py builtin commands succeed if settings are provided in the environment" "fulldefault: manage.py builtin commands succeed if settings are provided in the environment"
args = ['sqlall', 'admin_scripts'] args = ['sqlall', 'admin_scripts']
out, err = self.run_manage(args, 'regressiontests.settings') out, err = self.run_manage(args, 'test_project.settings')
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, 'CREATE TABLE') self.assertOutput(out, 'CREATE TABLE')
@ -772,7 +779,7 @@ class ManageFullPathDefaultSettings(AdminScriptTestCase):
def test_custom_command_with_settings(self): def test_custom_command_with_settings(self):
"fulldefault: manage.py can execute user commands when settings are provided as argument" "fulldefault: manage.py can execute user commands when settings are provided as argument"
args = ['noargs_command', '--settings=regressiontests.settings'] args = ['noargs_command', '--settings=test_project.settings']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:NoArgsCommand") self.assertOutput(out, "EXECUTE:NoArgsCommand")
@ -780,7 +787,7 @@ class ManageFullPathDefaultSettings(AdminScriptTestCase):
def test_custom_command_with_environment(self): def test_custom_command_with_environment(self):
"fulldefault: manage.py can execute user commands when settings are provided in environment" "fulldefault: manage.py can execute user commands when settings are provided in environment"
args = ['noargs_command'] args = ['noargs_command']
out, err = self.run_manage(args, 'regressiontests.settings') out, err = self.run_manage(args, 'test_project.settings')
self.assertNoOutput(err) self.assertNoOutput(err)
self.assertOutput(out, "EXECUTE:NoArgsCommand") self.assertOutput(out, "EXECUTE:NoArgsCommand")
@ -803,7 +810,7 @@ class ManageMinimalSettings(AdminScriptTestCase):
def test_builtin_with_settings(self): def test_builtin_with_settings(self):
"minimal: manage.py builtin commands fail if settings are provided as argument" "minimal: manage.py builtin commands fail if settings are provided as argument"
args = ['sqlall', '--settings=regressiontests.settings', 'admin_scripts'] args = ['sqlall', '--settings=test_project.settings', 'admin_scripts']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(out) self.assertNoOutput(out)
self.assertOutput(err, 'App with label admin_scripts could not be found') self.assertOutput(err, 'App with label admin_scripts could not be found')
@ -811,7 +818,7 @@ class ManageMinimalSettings(AdminScriptTestCase):
def test_builtin_with_environment(self): def test_builtin_with_environment(self):
"minimal: manage.py builtin commands fail if settings are provided in the environment" "minimal: manage.py builtin commands fail if settings are provided in the environment"
args = ['sqlall', 'admin_scripts'] args = ['sqlall', 'admin_scripts']
out, err = self.run_manage(args, 'regressiontests.settings') out, err = self.run_manage(args, 'test_project.settings')
self.assertNoOutput(out) self.assertNoOutput(out)
self.assertOutput(err, 'App with label admin_scripts could not be found') self.assertOutput(err, 'App with label admin_scripts could not be found')
@ -838,7 +845,7 @@ class ManageMinimalSettings(AdminScriptTestCase):
def test_custom_command_with_settings(self): def test_custom_command_with_settings(self):
"minimal: manage.py can't execute user commands, even if settings are provided as argument" "minimal: manage.py can't execute user commands, even if settings are provided as argument"
args = ['noargs_command', '--settings=regressiontests.settings'] args = ['noargs_command', '--settings=test_project.settings']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(out) self.assertNoOutput(out)
self.assertOutput(err, "Unknown command: 'noargs_command'") self.assertOutput(err, "Unknown command: 'noargs_command'")
@ -846,7 +853,7 @@ class ManageMinimalSettings(AdminScriptTestCase):
def test_custom_command_with_environment(self): def test_custom_command_with_environment(self):
"minimal: manage.py can't execute user commands, even if settings are provided in environment" "minimal: manage.py can't execute user commands, even if settings are provided in environment"
args = ['noargs_command'] args = ['noargs_command']
out, err = self.run_manage(args, 'regressiontests.settings') out, err = self.run_manage(args, 'test_project.settings')
self.assertNoOutput(out) self.assertNoOutput(out)
self.assertOutput(err, "Unknown command: 'noargs_command'") self.assertOutput(err, "Unknown command: 'noargs_command'")
@ -865,7 +872,7 @@ class ManageAlternateSettings(AdminScriptTestCase):
args = ['sqlall', 'admin_scripts'] args = ['sqlall', 'admin_scripts']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(out) self.assertNoOutput(out)
self.assertOutput(err, "Could not import settings 'regressiontests.settings'") self.assertOutput(err, "Could not import settings 'test_project.settings'")
def test_builtin_with_settings(self): def test_builtin_with_settings(self):
"alternate: manage.py builtin commands work with settings provided as argument" "alternate: manage.py builtin commands work with settings provided as argument"
@ -904,7 +911,7 @@ class ManageAlternateSettings(AdminScriptTestCase):
args = ['noargs_command'] args = ['noargs_command']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertNoOutput(out) self.assertNoOutput(out)
self.assertOutput(err, "Could not import settings 'regressiontests.settings'") self.assertOutput(err, "Could not import settings 'test_project.settings'")
def test_custom_command_with_settings(self): def test_custom_command_with_settings(self):
"alternate: manage.py can execute user commands if settings are provided as argument" "alternate: manage.py can execute user commands if settings are provided as argument"
@ -1007,7 +1014,7 @@ class ManageSettingsWithImportError(AdminScriptTestCase):
else: else:
settings_file_path = os.path.join(test_dir, filename) settings_file_path = os.path.join(test_dir, filename)
with open(settings_file_path, 'w') as settings_file: with open(settings_file_path, 'w') as settings_file:
settings_file.write('# Settings file automatically generated by regressiontests.admin_scripts test case\n') settings_file.write('# Settings file automatically generated by admin_scripts test case\n')
settings_file.write('# The next line will cause an import error:\nimport foo42bar\n') settings_file.write('# The next line will cause an import error:\nimport foo42bar\n')
def test_builtin_command(self): def test_builtin_command(self):
@ -1104,13 +1111,13 @@ class ManageTestCommand(AdminScriptTestCase):
address_predefined = 'DJANGO_LIVE_TEST_SERVER_ADDRESS' in os.environ address_predefined = 'DJANGO_LIVE_TEST_SERVER_ADDRESS' in os.environ
old_address = os.environ.get('DJANGO_LIVE_TEST_SERVER_ADDRESS') old_address = os.environ.get('DJANGO_LIVE_TEST_SERVER_ADDRESS')
self.cmd.handle(verbosity=0, testrunner='regressiontests.admin_scripts.tests.CustomTestRunner') self.cmd.handle(verbosity=0, testrunner='admin_scripts.tests.CustomTestRunner')
# Original state hasn't changed # Original state hasn't changed
self.assertEqual('DJANGO_LIVE_TEST_SERVER_ADDRESS' in os.environ, address_predefined) self.assertEqual('DJANGO_LIVE_TEST_SERVER_ADDRESS' in os.environ, address_predefined)
self.assertEqual(os.environ.get('DJANGO_LIVE_TEST_SERVER_ADDRESS'), old_address) self.assertEqual(os.environ.get('DJANGO_LIVE_TEST_SERVER_ADDRESS'), old_address)
self.cmd.handle(verbosity=0, testrunner='regressiontests.admin_scripts.tests.CustomTestRunner', self.cmd.handle(verbosity=0, testrunner='admin_scripts.tests.CustomTestRunner',
liveserver='blah') liveserver='blah')
# Variable was correctly set # Variable was correctly set
@ -1485,7 +1492,7 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
def test_custom_project_template(self): def test_custom_project_template(self):
"Make sure the startproject management command is able to use a different project template" "Make sure the startproject management command is able to use a different project template"
template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'project_template') template_path = os.path.join(custom_templates_dir, 'project_template')
args = ['startproject', '--template', template_path, 'customtestproject'] args = ['startproject', '--template', template_path, 'customtestproject']
testproject_dir = os.path.join(test_dir, 'customtestproject') testproject_dir = os.path.join(test_dir, 'customtestproject')
self.addCleanup(shutil.rmtree, testproject_dir, True) self.addCleanup(shutil.rmtree, testproject_dir, True)
@ -1497,7 +1504,7 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
def test_template_dir_with_trailing_slash(self): def test_template_dir_with_trailing_slash(self):
"Ticket 17475: Template dir passed has a trailing path separator" "Ticket 17475: Template dir passed has a trailing path separator"
template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'project_template' + os.sep) template_path = os.path.join(custom_templates_dir, 'project_template' + os.sep)
args = ['startproject', '--template', template_path, 'customtestproject'] args = ['startproject', '--template', template_path, 'customtestproject']
testproject_dir = os.path.join(test_dir, 'customtestproject') testproject_dir = os.path.join(test_dir, 'customtestproject')
self.addCleanup(shutil.rmtree, testproject_dir, True) self.addCleanup(shutil.rmtree, testproject_dir, True)
@ -1509,7 +1516,7 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
def test_custom_project_template_from_tarball_by_path(self): def test_custom_project_template_from_tarball_by_path(self):
"Make sure the startproject management command is able to use a different project template from a tarball" "Make sure the startproject management command is able to use a different project template from a tarball"
template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'project_template.tgz') template_path = os.path.join(custom_templates_dir, 'project_template.tgz')
args = ['startproject', '--template', template_path, 'tarballtestproject'] args = ['startproject', '--template', template_path, 'tarballtestproject']
testproject_dir = os.path.join(test_dir, 'tarballtestproject') testproject_dir = os.path.join(test_dir, 'tarballtestproject')
self.addCleanup(shutil.rmtree, testproject_dir, True) self.addCleanup(shutil.rmtree, testproject_dir, True)
@ -1521,7 +1528,7 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
def test_custom_project_template_from_tarball_to_alternative_location(self): def test_custom_project_template_from_tarball_to_alternative_location(self):
"Startproject can use a project template from a tarball and create it in a specified location" "Startproject can use a project template from a tarball and create it in a specified location"
template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'project_template.tgz') template_path = os.path.join(custom_templates_dir, 'project_template.tgz')
args = ['startproject', '--template', template_path, 'tarballtestproject', 'altlocation'] args = ['startproject', '--template', template_path, 'tarballtestproject', 'altlocation']
testproject_dir = os.path.join(test_dir, 'altlocation') testproject_dir = os.path.join(test_dir, 'altlocation')
os.mkdir(testproject_dir) os.mkdir(testproject_dir)
@ -1560,7 +1567,7 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
def test_file_without_extension(self): def test_file_without_extension(self):
"Make sure the startproject management command is able to render custom files" "Make sure the startproject management command is able to render custom files"
template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'project_template') template_path = os.path.join(custom_templates_dir, 'project_template')
args = ['startproject', '--template', template_path, 'customtestproject', '-e', 'txt', '-n', 'Procfile'] args = ['startproject', '--template', template_path, 'customtestproject', '-e', 'txt', '-n', 'Procfile']
testproject_dir = os.path.join(test_dir, 'customtestproject') testproject_dir = os.path.join(test_dir, 'customtestproject')
self.addCleanup(shutil.rmtree, testproject_dir, True) self.addCleanup(shutil.rmtree, testproject_dir, True)
@ -1578,7 +1585,7 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
def test_custom_project_template_context_variables(self): def test_custom_project_template_context_variables(self):
"Make sure template context variables are rendered with proper values" "Make sure template context variables are rendered with proper values"
template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'project_template') template_path = os.path.join(custom_templates_dir, 'project_template')
args = ['startproject', '--template', template_path, 'another_project', 'project_dir'] args = ['startproject', '--template', template_path, 'another_project', 'project_dir']
testproject_dir = os.path.join(test_dir, 'project_dir') testproject_dir = os.path.join(test_dir, 'project_dir')
os.mkdir(testproject_dir) os.mkdir(testproject_dir)
@ -1596,7 +1603,7 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
# We're using a custom command so we need the alternate settings # We're using a custom command so we need the alternate settings
self.write_settings('alternate_settings.py') self.write_settings('alternate_settings.py')
self.addCleanup(self.remove_settings, 'alternate_settings.py') self.addCleanup(self.remove_settings, 'alternate_settings.py')
template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'project_template') template_path = os.path.join(custom_templates_dir, 'project_template')
args = ['custom_startproject', '--template', template_path, 'another_project', 'project_dir', '--extra', '<&>', '--settings=alternate_settings'] args = ['custom_startproject', '--template', template_path, 'another_project', 'project_dir', '--extra', '<&>', '--settings=alternate_settings']
testproject_dir = os.path.join(test_dir, 'project_dir') testproject_dir = os.path.join(test_dir, 'project_dir')
os.mkdir(testproject_dir) os.mkdir(testproject_dir)
@ -1613,7 +1620,7 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
Make sure an exception is raised when the provided Make sure an exception is raised when the provided
destination directory doesn't exist destination directory doesn't exist
""" """
template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'project_template') template_path = os.path.join(custom_templates_dir, 'project_template')
args = ['startproject', '--template', template_path, 'yet_another_project', 'project_dir2'] args = ['startproject', '--template', template_path, 'yet_another_project', 'project_dir2']
testproject_dir = os.path.join(test_dir, 'project_dir2') testproject_dir = os.path.join(test_dir, 'project_dir2')
out, err = self.run_django_admin(args) out, err = self.run_django_admin(args)
@ -1623,7 +1630,7 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
def test_custom_project_template_with_non_ascii_templates(self): def test_custom_project_template_with_non_ascii_templates(self):
"Ticket 18091: Make sure the startproject management command is able to render templates with non-ASCII content" "Ticket 18091: Make sure the startproject management command is able to render templates with non-ASCII content"
template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'project_template') template_path = os.path.join(custom_templates_dir, 'project_template')
args = ['startproject', '--template', template_path, '--extension=txt', 'customtestproject'] args = ['startproject', '--template', template_path, '--extension=txt', 'customtestproject']
testproject_dir = os.path.join(test_dir, 'customtestproject') testproject_dir = os.path.join(test_dir, 'customtestproject')
self.addCleanup(shutil.rmtree, testproject_dir, True) self.addCleanup(shutil.rmtree, testproject_dir, True)

View File

@ -142,7 +142,7 @@ class ValidationTestCase(TestCase):
model = TwoAlbumFKAndAnE model = TwoAlbumFKAndAnE
self.assertRaisesMessage(Exception, self.assertRaisesMessage(Exception,
"<class 'regressiontests.admin_validation.models.TwoAlbumFKAndAnE'> has more than 1 ForeignKey to <class 'regressiontests.admin_validation.models.Album'>", "<class 'admin_validation.models.TwoAlbumFKAndAnE'> has more than 1 ForeignKey to <class 'admin_validation.models.Album'>",
validate_inline, validate_inline,
TwoAlbumFKAndAnEInline, None, Album) TwoAlbumFKAndAnEInline, None, Album)

View File

@ -64,7 +64,7 @@ class AdminViewBasicTest(TestCase):
# this test case and changing urlbit. # this test case and changing urlbit.
urlbit = 'admin' urlbit = 'admin'
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
def setUp(self): def setUp(self):
self.old_USE_I18N = settings.USE_I18N self.old_USE_I18N = settings.USE_I18N
@ -610,7 +610,7 @@ class AdminViewBasicTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminViewFormUrlTest(TestCase): class AdminViewFormUrlTest(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ["admin-views-users.xml"] fixtures = ["admin-views-users.xml"]
urlbit = "admin3" urlbit = "admin3"
@ -644,7 +644,7 @@ class AdminViewFormUrlTest(TestCase):
class AdminJavaScriptTest(TestCase): class AdminJavaScriptTest(TestCase):
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
def setUp(self): def setUp(self):
self.client.login(username='super', password='secret') self.client.login(username='super', password='secret')
@ -709,7 +709,7 @@ class AdminJavaScriptTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class SaveAsTests(TestCase): class SaveAsTests(TestCase):
urls = "regressiontests.admin_views.urls" 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):
@ -739,7 +739,7 @@ class SaveAsTests(TestCase):
class CustomModelAdminTest(AdminViewBasicTest): class CustomModelAdminTest(AdminViewBasicTest):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
urlbit = "admin2" urlbit = "admin2"
def testCustomAdminSiteLoginForm(self): def testCustomAdminSiteLoginForm(self):
@ -816,7 +816,7 @@ def get_perm(Model, perm):
class AdminViewPermissionsTest(TestCase): class AdminViewPermissionsTest(TestCase):
"""Tests for Admin Views Permissions.""" """Tests for Admin Views Permissions."""
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -1257,7 +1257,7 @@ class AdminViewPermissionsTest(TestCase):
class AdminViewsNoUrlTest(TestCase): class AdminViewsNoUrlTest(TestCase):
"""Regression test for #17333""" """Regression test for #17333"""
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -1287,7 +1287,7 @@ class AdminViewsNoUrlTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminViewDeletedObjectsTest(TestCase): class AdminViewDeletedObjectsTest(TestCase):
urls = "regressiontests.admin_views.urls" 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):
@ -1405,7 +1405,7 @@ class AdminViewDeletedObjectsTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminViewStringPrimaryKeyTest(TestCase): class AdminViewStringPrimaryKeyTest(TestCase):
urls = "regressiontests.admin_views.urls" 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):
@ -1526,7 +1526,7 @@ class AdminViewStringPrimaryKeyTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class SecureViewTests(TestCase): class SecureViewTests(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -1686,7 +1686,7 @@ class SecureViewTests(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminViewUnicodeTest(TestCase): class AdminViewUnicodeTest(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-unicode.xml'] fixtures = ['admin-views-unicode.xml']
def setUp(self): def setUp(self):
@ -1741,7 +1741,7 @@ class AdminViewUnicodeTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminViewListEditable(TestCase): class AdminViewListEditable(TestCase):
urls = "regressiontests.admin_views.urls" 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):
@ -2118,7 +2118,7 @@ class AdminViewListEditable(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminSearchTest(TestCase): class AdminSearchTest(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users', 'multiple-child-classes', fixtures = ['admin-views-users', 'multiple-child-classes',
'admin-views-person'] 'admin-views-person']
@ -2166,7 +2166,7 @@ class AdminSearchTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminInheritedInlinesTest(TestCase): class AdminInheritedInlinesTest(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -2254,7 +2254,7 @@ class AdminInheritedInlinesTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminActionsTest(TestCase): class AdminActionsTest(TestCase):
urls = "regressiontests.admin_views.urls" 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):
@ -2473,7 +2473,7 @@ class AdminActionsTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class TestCustomChangeList(TestCase): class TestCustomChangeList(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
urlbit = 'admin' urlbit = 'admin'
@ -2502,7 +2502,7 @@ class TestCustomChangeList(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class TestInlineNotEditable(TestCase): class TestInlineNotEditable(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -2522,7 +2522,7 @@ class TestInlineNotEditable(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminCustomQuerysetTest(TestCase): class AdminCustomQuerysetTest(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -2748,7 +2748,7 @@ class AdminCustomQuerysetTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminInlineFileUploadTest(TestCase): class AdminInlineFileUploadTest(TestCase):
urls = "regressiontests.admin_views.urls" 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'
@ -2795,7 +2795,7 @@ class AdminInlineFileUploadTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminInlineTests(TestCase): class AdminInlineTests(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -3114,7 +3114,7 @@ class AdminInlineTests(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class NeverCacheTests(TestCase): class NeverCacheTests(TestCase):
urls = "regressiontests.admin_views.urls" 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):
@ -3188,7 +3188,7 @@ class NeverCacheTests(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class PrePopulatedTest(TestCase): class PrePopulatedTest(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -3225,7 +3225,7 @@ class PrePopulatedTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase): class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver' webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def test_prepopulated_fields(self): def test_prepopulated_fields(self):
@ -3356,7 +3356,7 @@ class SeleniumAdminViewsIETests(SeleniumAdminViewsFirefoxTests):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class ReadonlyTest(TestCase): class ReadonlyTest(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -3444,7 +3444,7 @@ class ReadonlyTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class RawIdFieldsTest(TestCase): class RawIdFieldsTest(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -3482,7 +3482,7 @@ class UserAdminTest(TestCase):
""" """
Tests user CRUD functionality. Tests user CRUD functionality.
""" """
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -3583,7 +3583,7 @@ class GroupAdminTest(TestCase):
""" """
Tests group CRUD functionality. Tests group CRUD functionality.
""" """
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -3612,7 +3612,7 @@ class GroupAdminTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class CSSTest(TestCase): class CSSTest(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -3668,7 +3668,7 @@ 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',))
class AdminDocsTest(TestCase): class AdminDocsTest(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -3711,7 +3711,7 @@ class AdminDocsTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class ValidXHTMLTests(TestCase): class ValidXHTMLTests(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
urlbit = 'admin' urlbit = 'admin'
@ -3735,7 +3735,7 @@ class ValidXHTMLTests(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class DateHierarchyTests(TestCase): class DateHierarchyTests(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -3867,7 +3867,7 @@ 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 = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -3932,7 +3932,7 @@ class AdminCustomSaveRelatedTests(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminViewLogoutTest(TestCase): class AdminViewLogoutTest(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):
@ -3961,7 +3961,7 @@ class AdminViewLogoutTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminUserMessageTest(TestCase): class AdminUserMessageTest(TestCase):
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
fixtures = ['admin-views-users.xml'] fixtures = ['admin-views-users.xml']
def setUp(self): def setUp(self):

View File

@ -460,7 +460,7 @@ class RelatedFieldWidgetWrapperTests(DjangoTestCase):
class DateTimePickerSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase): class DateTimePickerSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver' webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
fixtures = ['admin-widgets-users.xml'] fixtures = ['admin-widgets-users.xml']
urls = "regressiontests.admin_widgets.urls" urls = "admin_widgets.urls"
def test_show_hide_date_time_picker_widgets(self): def test_show_hide_date_time_picker_widgets(self):
""" """
@ -516,7 +516,7 @@ class DateTimePickerSeleniumIETests(DateTimePickerSeleniumFirefoxTests):
class HorizontalVerticalFilterSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase): class HorizontalVerticalFilterSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver' webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
fixtures = ['admin-widgets-users.xml'] fixtures = ['admin-widgets-users.xml']
urls = "regressiontests.admin_widgets.urls" urls = "admin_widgets.urls"
def setUp(self): def setUp(self):
self.lisa = models.Student.objects.create(name='Lisa') self.lisa = models.Student.objects.create(name='Lisa')

14
tests/cache/tests.py vendored
View File

@ -809,7 +809,7 @@ class DBCacheTests(BaseCacheTests, TransactionTestCase):
self.prefix_cache = get_cache(self.backend_name, LOCATION=self._table_name, KEY_PREFIX='cacheprefix') self.prefix_cache = get_cache(self.backend_name, LOCATION=self._table_name, KEY_PREFIX='cacheprefix')
self.v2_cache = get_cache(self.backend_name, LOCATION=self._table_name, VERSION=2) self.v2_cache = get_cache(self.backend_name, LOCATION=self._table_name, VERSION=2)
self.custom_key_cache = get_cache(self.backend_name, LOCATION=self._table_name, KEY_FUNCTION=custom_key_func) self.custom_key_cache = get_cache(self.backend_name, LOCATION=self._table_name, KEY_FUNCTION=custom_key_func)
self.custom_key_cache2 = get_cache(self.backend_name, LOCATION=self._table_name, KEY_FUNCTION='regressiontests.cache.tests.custom_key_func') self.custom_key_cache2 = get_cache(self.backend_name, LOCATION=self._table_name, KEY_FUNCTION='cache.tests.custom_key_func')
def tearDown(self): def tearDown(self):
from django.db import connection from django.db import connection
@ -897,7 +897,7 @@ class LocMemCacheTests(unittest.TestCase, BaseCacheTests):
self.prefix_cache = get_cache(self.backend_name, KEY_PREFIX='cacheprefix') self.prefix_cache = get_cache(self.backend_name, KEY_PREFIX='cacheprefix')
self.v2_cache = get_cache(self.backend_name, VERSION=2) self.v2_cache = get_cache(self.backend_name, VERSION=2)
self.custom_key_cache = get_cache(self.backend_name, OPTIONS={'MAX_ENTRIES': 30}, KEY_FUNCTION=custom_key_func) self.custom_key_cache = get_cache(self.backend_name, OPTIONS={'MAX_ENTRIES': 30}, KEY_FUNCTION=custom_key_func)
self.custom_key_cache2 = get_cache(self.backend_name, OPTIONS={'MAX_ENTRIES': 30}, KEY_FUNCTION='regressiontests.cache.tests.custom_key_func') self.custom_key_cache2 = get_cache(self.backend_name, OPTIONS={'MAX_ENTRIES': 30}, KEY_FUNCTION='cache.tests.custom_key_func')
# LocMem requires a hack to make the other caches # LocMem requires a hack to make the other caches
# share a data store with the 'normal' cache. # share a data store with the 'normal' cache.
@ -966,7 +966,7 @@ class MemcachedCacheTests(unittest.TestCase, BaseCacheTests):
self.prefix_cache = get_cache(cache_key, KEY_PREFIX=random_prefix) self.prefix_cache = get_cache(cache_key, KEY_PREFIX=random_prefix)
self.v2_cache = get_cache(cache_key, VERSION=2) self.v2_cache = get_cache(cache_key, VERSION=2)
self.custom_key_cache = get_cache(cache_key, KEY_FUNCTION=custom_key_func) self.custom_key_cache = get_cache(cache_key, KEY_FUNCTION=custom_key_func)
self.custom_key_cache2 = get_cache(cache_key, KEY_FUNCTION='regressiontests.cache.tests.custom_key_func') self.custom_key_cache2 = get_cache(cache_key, KEY_FUNCTION='cache.tests.custom_key_func')
def tearDown(self): def tearDown(self):
self.cache.clear() self.cache.clear()
@ -1011,7 +1011,7 @@ class FileBasedCacheTests(unittest.TestCase, BaseCacheTests):
self.prefix_cache = get_cache(self.backend_name, LOCATION=self.dirname, KEY_PREFIX='cacheprefix') self.prefix_cache = get_cache(self.backend_name, LOCATION=self.dirname, KEY_PREFIX='cacheprefix')
self.v2_cache = get_cache(self.backend_name, LOCATION=self.dirname, VERSION=2) self.v2_cache = get_cache(self.backend_name, LOCATION=self.dirname, VERSION=2)
self.custom_key_cache = get_cache(self.backend_name, LOCATION=self.dirname, KEY_FUNCTION=custom_key_func) self.custom_key_cache = get_cache(self.backend_name, LOCATION=self.dirname, KEY_FUNCTION=custom_key_func)
self.custom_key_cache2 = get_cache(self.backend_name, LOCATION=self.dirname, KEY_FUNCTION='regressiontests.cache.tests.custom_key_func') self.custom_key_cache2 = get_cache(self.backend_name, LOCATION=self.dirname, KEY_FUNCTION='cache.tests.custom_key_func')
def tearDown(self): def tearDown(self):
self.cache.clear() self.cache.clear()
@ -1055,7 +1055,7 @@ class CustomCacheKeyValidationTests(unittest.TestCase):
""" """
def test_custom_key_validation(self): def test_custom_key_validation(self):
cache = get_cache('regressiontests.cache.liberal_backend://') cache = get_cache('cache.liberal_backend://')
# this key is both longer than 250 characters, and has spaces # this key is both longer than 250 characters, and has spaces
key = 'some key with spaces' * 15 key = 'some key with spaces' * 15
@ -1082,7 +1082,7 @@ class GetCacheTests(unittest.TestCase):
def test_close(self): def test_close(self):
from django.core import signals from django.core import signals
cache = get_cache('regressiontests.cache.closeable_cache.CacheClass') cache = get_cache('cache.closeable_cache.CacheClass')
self.assertFalse(cache.closed) self.assertFalse(cache.closed)
signals.request_finished.send(self.__class__) signals.request_finished.send(self.__class__)
self.assertTrue(cache.closed) self.assertTrue(cache.closed)
@ -1865,7 +1865,7 @@ class TestWithTemplateResponse(TestCase):
class TestEtagWithAdmin(TestCase): class TestEtagWithAdmin(TestCase):
# See https://code.djangoproject.com/ticket/16003 # See https://code.djangoproject.com/ticket/16003
urls = "regressiontests.admin_views.urls" urls = "admin_views.urls"
def test_admin(self): def test_admin(self):
with self.settings(USE_ETAGS=False): with self.settings(USE_ETAGS=False):

View File

@ -7,7 +7,7 @@ from django.db import connections, DEFAULT_DB_ALIAS, models
from django.test import TestCase from django.test import TestCase
from django.utils import six from django.utils import six
# See also regressiontests/initial_sql_regress for 'custom_sql_for_model' tests # See also initial_sql_regress for 'custom_sql_for_model' tests
class SQLCommandsTestCase(TestCase): class SQLCommandsTestCase(TestCase):

View File

@ -1,32 +1,32 @@
from django.core import urlresolvers from django.core import urlresolvers
from regressiontests.comment_tests.custom_comments.models import CustomComment from comment_tests.custom_comments.models import CustomComment
from regressiontests.comment_tests.custom_comments.forms import CustomCommentForm from comment_tests.custom_comments.forms import CustomCommentForm
def get_model(): def get_model():
return CustomComment return CustomComment
def get_form(): def get_form():
return CustomCommentForm return CustomCommentForm
def get_form_target(): def get_form_target():
return urlresolvers.reverse( return urlresolvers.reverse(
"regressiontests.comment_tests.custom_comments.views.custom_submit_comment" "comment_tests.custom_comments.views.custom_submit_comment"
) )
def get_flag_url(c): def get_flag_url(c):
return urlresolvers.reverse( return urlresolvers.reverse(
"regressiontests.comment_tests.custom_comments.views.custom_flag_comment", "comment_tests.custom_comments.views.custom_flag_comment",
args=(c.id,) args=(c.id,)
) )
def get_delete_url(c): def get_delete_url(c):
return urlresolvers.reverse( return urlresolvers.reverse(
"regressiontests.comment_tests.custom_comments.views.custom_delete_comment", "comment_tests.custom_comments.views.custom_delete_comment",
args=(c.id,) args=(c.id,)
) )
def get_approve_url(c): def get_approve_url(c):
return urlresolvers.reverse( return urlresolvers.reverse(
"regressiontests.comment_tests.custom_comments.views.custom_approve_comment", "comment_tests.custom_comments.views.custom_approve_comment",
args=(c.id,) args=(c.id,)
) )

View File

@ -17,7 +17,7 @@ CT = ContentType.objects.get_for_model
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',))
class CommentTestCase(TestCase): class CommentTestCase(TestCase):
fixtures = ["comment_tests"] fixtures = ["comment_tests"]
urls = 'regressiontests.comment_tests.urls_default' urls = 'comment_tests.urls_default'
def createSomeComments(self): def createSomeComments(self):
# Two anonymous comments on two different objects # Two anonymous comments on two different objects
@ -85,11 +85,11 @@ class CommentTestCase(TestCase):
d.update(f.initial) d.update(f.initial)
return d return d
from regressiontests.comment_tests.tests.app_api_tests import * from comment_tests.tests.app_api_tests import *
from regressiontests.comment_tests.tests.feed_tests import * from comment_tests.tests.feed_tests import *
from regressiontests.comment_tests.tests.model_tests import * from comment_tests.tests.model_tests import *
from regressiontests.comment_tests.tests.comment_form_tests import * from comment_tests.tests.comment_form_tests import *
from regressiontests.comment_tests.tests.templatetag_tests import * from comment_tests.tests.templatetag_tests import *
from regressiontests.comment_tests.tests.comment_view_tests import * from comment_tests.tests.comment_view_tests import *
from regressiontests.comment_tests.tests.moderation_view_tests import * from comment_tests.tests.moderation_view_tests import *
from regressiontests.comment_tests.tests.comment_utils_moderators_tests import * from comment_tests.tests.comment_utils_moderators_tests import *

View File

@ -45,23 +45,23 @@ class CommentAppAPITests(CommentTestCase):
@override_settings( @override_settings(
COMMENTS_APP='regressiontests.comment_tests.custom_comments', COMMENTS_APP='comment_tests.custom_comments',
INSTALLED_APPS=list(settings.INSTALLED_APPS) + [ INSTALLED_APPS=list(settings.INSTALLED_APPS) + [
'regressiontests.comment_tests.custom_comments'], 'comment_tests.custom_comments'],
) )
class CustomCommentTest(CommentTestCase): class CustomCommentTest(CommentTestCase):
urls = 'regressiontests.comment_tests.urls' urls = 'comment_tests.urls'
def testGetCommentApp(self): def testGetCommentApp(self):
from regressiontests.comment_tests import custom_comments from comment_tests import custom_comments
self.assertEqual(comments.get_comment_app(), custom_comments) self.assertEqual(comments.get_comment_app(), custom_comments)
def testGetModel(self): def testGetModel(self):
from regressiontests.comment_tests.custom_comments.models import CustomComment from comment_tests.custom_comments.models import CustomComment
self.assertEqual(comments.get_model(), CustomComment) self.assertEqual(comments.get_model(), CustomComment)
def testGetForm(self): def testGetForm(self):
from regressiontests.comment_tests.custom_comments.forms import CustomCommentForm from comment_tests.custom_comments.forms import CustomCommentForm
self.assertEqual(comments.get_form(), CustomCommentForm) self.assertEqual(comments.get_form(), CustomCommentForm)
def testGetFormTarget(self): def testGetFormTarget(self):

View File

@ -12,7 +12,7 @@ from ..models import Article
class CommentFeedTests(CommentTestCase): class CommentFeedTests(CommentTestCase):
urls = 'regressiontests.comment_tests.urls' urls = 'comment_tests.urls'
feed_url = '/rss/comments/' feed_url = '/rss/comments/'
def setUp(self): def setUp(self):

View File

@ -252,7 +252,7 @@ class ApproveViewTests(CommentTestCase):
self.assertTemplateUsed(response, "comments/approved.html") self.assertTemplateUsed(response, "comments/approved.html")
class AdminActionsTests(CommentTestCase): class AdminActionsTests(CommentTestCase):
urls = "regressiontests.comment_tests.urls_admin" urls = "comment_tests.urls_admin"
def setUp(self): def setUp(self):
super(AdminActionsTests, self).setUp() super(AdminActionsTests, self).setUp()

View File

@ -16,7 +16,7 @@ ETAG = 'b4246ffc4f62314ca13147c9d4f76974'
EXPIRED_ETAG = '7fae4cd4b0f81e7d2914700043aa8ed6' EXPIRED_ETAG = '7fae4cd4b0f81e7d2914700043aa8ed6'
class ConditionalGet(TestCase): class ConditionalGet(TestCase):
urls = 'regressiontests.conditional_processing.urls' 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)

View File

@ -9,7 +9,7 @@ class RequestContextProcessorTests(TestCase):
Tests for the ``django.core.context_processors.request`` processor. Tests for the ``django.core.context_processors.request`` processor.
""" """
urls = 'regressiontests.context_processors.urls' urls = 'context_processors.urls'
def test_request_attributes(self): def test_request_attributes(self):
""" """

View File

@ -2,5 +2,5 @@ from django.test import TestCase
class NoModelTests(TestCase): class NoModelTests(TestCase):
""" A placeholder test case. See modeltests.empty.tests for more info. """ """ A placeholder test case. See empty.tests for more info. """
pass pass

View File

@ -31,7 +31,7 @@ class NoModelTests(TestCase):
It seemed like an appropriate home for it. It seemed like an appropriate home for it.
""" """
@override_settings(INSTALLED_APPS=("modeltests.empty.no_models",)) @override_settings(INSTALLED_APPS=("empty.no_models",))
def test_no_models(self): def test_no_models(self):
with six.assertRaisesRegex(self, ImproperlyConfigured, with six.assertRaisesRegex(self, ImproperlyConfigured,
'App with label no_models is missing a models.py module.'): 'App with label no_models is missing a models.py module.'):

View File

@ -27,7 +27,7 @@ from django.utils import six
from django.utils import unittest from django.utils import unittest
from django.utils._os import upath from django.utils._os import upath
from django.test.utils import override_settings from django.test.utils import override_settings
from ..servers.tests import LiveServerBase from servers.tests import LiveServerBase
# Try to import PIL in either of the two ways it can end up installed. # Try to import PIL in either of the two ways it can end up installed.
# Checking for the existence of Image is enough for CPython, but # Checking for the existence of Image is enough for CPython, but

View File

@ -237,7 +237,7 @@ class FormsErrorMessagesTestCase(TestCase, AssertFormErrorsMixin):
class ModelChoiceFieldErrorMessagesTestCase(TestCase, AssertFormErrorsMixin): class ModelChoiceFieldErrorMessagesTestCase(TestCase, AssertFormErrorsMixin):
def test_modelchoicefield(self): def test_modelchoicefield(self):
# Create choices for the model choice field tests below. # Create choices for the model choice field tests below.
from regressiontests.forms.models import ChoiceModel from forms_tests.models import ChoiceModel
c1 = ChoiceModel.objects.create(pk=1, name='a') c1 = ChoiceModel.objects.create(pk=1, name='a')
c2 = ChoiceModel.objects.create(pk=2, name='b') c2 = ChoiceModel.objects.create(pk=2, name='b')
c3 = ChoiceModel.objects.create(pk=3, name='c') c3 = ChoiceModel.objects.create(pk=3, name='c')

View File

@ -577,7 +577,7 @@ class FieldsTests(SimpleTestCase):
self.assertRaisesMessage(ValidationError, "'Enter a valid value.'", f.clean, 'abcd') self.assertRaisesMessage(ValidationError, "'Enter a valid value.'", f.clean, 'abcd')
# EmailField ################################################################## # EmailField ##################################################################
# See also modeltests/validators tests for validate_email specific tests # See also validators tests for validate_email specific tests
def test_emailfield_1(self): def test_emailfield_1(self):
f = EmailField() f = EmailField()
@ -1131,7 +1131,7 @@ class FieldsTests(SimpleTestCase):
f = FilePathField(path=path, allow_folders=True, allow_files=False) f = FilePathField(path=path, allow_folders=True, allow_files=False)
f.choices.sort() f.choices.sort()
expected = [ expected = [
('/tests/regressiontests/forms/tests/filepath_test_files/directory', 'directory'), ('/tests/forms_tests/tests/filepath_test_files/directory', 'directory'),
] ]
for exp, got in zip(expected, fix_os_paths(f.choices)): for exp, got in zip(expected, fix_os_paths(f.choices)):
self.assertEqual(exp[1], got[1]) self.assertEqual(exp[1], got[1])
@ -1140,10 +1140,10 @@ class FieldsTests(SimpleTestCase):
f = FilePathField(path=path, allow_folders=True, allow_files=True) f = FilePathField(path=path, allow_folders=True, allow_files=True)
f.choices.sort() f.choices.sort()
expected = [ expected = [
('/tests/regressiontests/forms/tests/filepath_test_files/.dot-file', '.dot-file'), ('/tests/forms_tests/tests/filepath_test_files/.dot-file', '.dot-file'),
('/tests/regressiontests/forms/tests/filepath_test_files/directory', 'directory'), ('/tests/forms_tests/tests/filepath_test_files/directory', 'directory'),
('/tests/regressiontests/forms/tests/filepath_test_files/fake-image.jpg', 'fake-image.jpg'), ('/tests/forms_tests/tests/filepath_test_files/fake-image.jpg', 'fake-image.jpg'),
('/tests/regressiontests/forms/tests/filepath_test_files/real-text-file.txt', 'real-text-file.txt'), ('/tests/forms_tests/tests/filepath_test_files/real-text-file.txt', 'real-text-file.txt'),
] ]
actual = fix_os_paths(f.choices) actual = fix_os_paths(f.choices)

View File

@ -7,7 +7,7 @@ from django.forms import *
from django.test import TestCase from django.test import TestCase
from django.utils.translation import ugettext_lazy, override from django.utils.translation import ugettext_lazy, override
from regressiontests.forms.models import Cheese from forms_tests.models import Cheese
class FormsRegressionsTestCase(TestCase): class FormsRegressionsTestCase(TestCase):
@ -121,7 +121,7 @@ class FormsRegressionsTestCase(TestCase):
f = SomeForm({'field': ['<script>']}) f = SomeForm({'field': ['<script>']})
self.assertHTMLEqual(t.render(Context({'form': f})), '<ul class="errorlist"><li>field<ul class="errorlist"><li>Select a valid choice. &lt;script&gt; is not one of the available choices.</li></ul></li></ul>') self.assertHTMLEqual(t.render(Context({'form': f})), '<ul class="errorlist"><li>field<ul class="errorlist"><li>Select a valid choice. &lt;script&gt; is not one of the available choices.</li></ul></li></ul>')
from regressiontests.forms.models import ChoiceModel from forms_tests.models import ChoiceModel
class SomeForm(Form): class SomeForm(Form):
field = ModelMultipleChoiceField(ChoiceModel.objects.all()) field = ModelMultipleChoiceField(ChoiceModel.objects.all())

View File

@ -1012,7 +1012,7 @@ class WidgetTests(TestCase):
class LiveWidgetTests(AdminSeleniumWebDriverTestCase): class LiveWidgetTests(AdminSeleniumWebDriverTestCase):
urls = 'regressiontests.forms.urls' urls = 'forms_tests.urls'
def test_textarea_trailing_newlines(self): def test_textarea_trailing_newlines(self):
""" """

View File

@ -5,5 +5,5 @@ from .views import ArticleFormView
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^/model_form/(?P<pk>\d+)/$', ArticleFormView.as_view(), name="article_form"), url(r'^model_form/(?P<pk>\d+)/$', ArticleFormView.as_view(), name="article_form"),
) )

View File

@ -19,7 +19,7 @@ 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',))
class GenericAdminViewTest(TestCase): class GenericAdminViewTest(TestCase):
urls = "regressiontests.generic_inline_admin.urls" urls = "generic_inline_admin.urls"
fixtures = ['users.xml'] fixtures = ['users.xml']
def setUp(self): def setUp(self):
@ -132,7 +132,7 @@ class GenericAdminViewTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class GenericInlineAdminParametersTest(TestCase): class GenericInlineAdminParametersTest(TestCase):
urls = "regressiontests.generic_inline_admin.urls" urls = "generic_inline_admin.urls"
fixtures = ['users.xml'] fixtures = ['users.xml']
def setUp(self): def setUp(self):
@ -186,7 +186,7 @@ class GenericInlineAdminParametersTest(TestCase):
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class GenericInlineAdminWithUniqueTogetherTest(TestCase): class GenericInlineAdminWithUniqueTogetherTest(TestCase):
urls = "regressiontests.generic_inline_admin.urls" urls = "generic_inline_admin.urls"
fixtures = ['users.xml'] fixtures = ['users.xml']
def setUp(self): def setUp(self):
@ -213,7 +213,7 @@ class GenericInlineAdminWithUniqueTogetherTest(TestCase):
self.assertEqual(response.status_code, 302) # redirect somewhere self.assertEqual(response.status_code, 302) # redirect somewhere
class NoInlineDeletionTest(TestCase): class NoInlineDeletionTest(TestCase):
urls = "regressiontests.generic_inline_admin.urls" urls = "generic_inline_admin.urls"
def test_no_deletion(self): def test_no_deletion(self):
fake_site = object() fake_site = object()
@ -235,7 +235,7 @@ request.user = MockSuperUser()
class GenericInlineModelAdminTest(TestCase): class GenericInlineModelAdminTest(TestCase):
urls = "regressiontests.generic_inline_admin.urls" urls = "generic_inline_admin.urls"
def setUp(self): def setUp(self):
self.site = AdminSite() self.site = AdminSite()

View File

@ -229,7 +229,7 @@ class ViewTest(unittest.TestCase):
class TemplateViewTest(TestCase): class TemplateViewTest(TestCase):
urls = 'regressiontests.generic_views.urls' urls = 'generic_views.urls'
rf = RequestFactory() rf = RequestFactory()

View File

@ -33,7 +33,7 @@ def _make_books(n, base_date):
class ArchiveIndexViewTests(TestCase): class ArchiveIndexViewTests(TestCase):
fixtures = ['generic-views-test-data.json'] fixtures = ['generic-views-test-data.json']
urls = 'regressiontests.generic_views.urls' urls = 'generic_views.urls'
def test_archive_view(self): def test_archive_view(self):
@ -136,7 +136,7 @@ class ArchiveIndexViewTests(TestCase):
class YearArchiveViewTests(TestCase): class YearArchiveViewTests(TestCase):
fixtures = ['generic-views-test-data.json'] fixtures = ['generic-views-test-data.json']
urls = 'regressiontests.generic_views.urls' 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/')
@ -221,7 +221,7 @@ class YearArchiveViewTests(TestCase):
class MonthArchiveViewTests(TestCase): class MonthArchiveViewTests(TestCase):
fixtures = ['generic-views-test-data.json'] fixtures = ['generic-views-test-data.json']
urls = 'regressiontests.generic_views.urls' 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/')
@ -348,7 +348,7 @@ class MonthArchiveViewTests(TestCase):
class WeekArchiveViewTests(TestCase): class WeekArchiveViewTests(TestCase):
fixtures = ['generic-views-test-data.json'] fixtures = ['generic-views-test-data.json']
urls = 'regressiontests.generic_views.urls' 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/')
@ -445,7 +445,7 @@ class WeekArchiveViewTests(TestCase):
class DayArchiveViewTests(TestCase): class DayArchiveViewTests(TestCase):
fixtures = ['generic-views-test-data.json'] fixtures = ['generic-views-test-data.json']
urls = 'regressiontests.generic_views.urls' 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/')
@ -563,7 +563,7 @@ class DayArchiveViewTests(TestCase):
class DateDetailViewTests(TestCase): class DateDetailViewTests(TestCase):
fixtures = ['generic-views-test-data.json'] fixtures = ['generic-views-test-data.json']
urls = 'regressiontests.generic_views.urls' 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/')

View File

@ -9,7 +9,7 @@ from .models import Artist, Author, Page
class DetailViewTest(TestCase): class DetailViewTest(TestCase):
fixtures = ['generic-views-test-data.json'] fixtures = ['generic-views-test-data.json']
urls = 'regressiontests.generic_views.urls' 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/')

View File

@ -22,7 +22,7 @@ class FormMixinTests(TestCase):
class BasicFormTests(TestCase): class BasicFormTests(TestCase):
urls = 'regressiontests.generic_views.urls' 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"})
@ -35,7 +35,7 @@ class ModelFormMixinTests(TestCase):
self.assertEqual(form_class._meta.model, Author) self.assertEqual(form_class._meta.model, Author)
class CreateViewTests(TestCase): class CreateViewTests(TestCase):
urls = 'regressiontests.generic_views.urls' 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/')
@ -114,7 +114,7 @@ class CreateViewTests(TestCase):
class UpdateViewTests(TestCase): class UpdateViewTests(TestCase):
urls = 'regressiontests.generic_views.urls' urls = 'generic_views.urls'
def test_update_post(self): def test_update_post(self):
a = Author.objects.create( a = Author.objects.create(
@ -252,7 +252,7 @@ class UpdateViewTests(TestCase):
class DeleteViewTests(TestCase): class DeleteViewTests(TestCase):
urls = 'regressiontests.generic_views.urls' 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'})

View File

@ -11,7 +11,7 @@ from .models import Author, Artist
class ListViewTests(TestCase): class ListViewTests(TestCase):
fixtures = ['generic-views-test-data.json'] fixtures = ['generic-views-test-data.json']
urls = 'regressiontests.generic_views.urls' urls = 'generic_views.urls'
def test_items(self): def test_items(self):
res = self.client.get('/list/dict/') res = self.client.get('/list/dict/')

View File

@ -31,7 +31,7 @@ class HandlerTests(TestCase):
class SignalsTests(TestCase): class SignalsTests(TestCase):
urls = 'regressiontests.handlers.urls' urls = 'handlers.urls'
def setUp(self): def setUp(self):
self.signals = [] self.signals = []

View File

@ -34,7 +34,7 @@ class URLTestCaseBase(TestCase):
""" """
TestCase base-class for the URL tests. TestCase base-class for the URL tests.
""" """
urls = 'regressiontests.i18n.patterns.urls.default' 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.
@ -61,13 +61,13 @@ class URLPrefixTests(URLTestCaseBase):
with translation.override('nl'): with translation.override('nl'):
self.assertEqual(reverse('prefixed'), '/nl/prefixed/') self.assertEqual(reverse('prefixed'), '/nl/prefixed/')
@override_settings(ROOT_URLCONF='regressiontests.i18n.patterns.urls.wrong') @override_settings(ROOT_URLCONF='i18n.patterns.urls.wrong')
def test_invalid_prefix_use(self): def test_invalid_prefix_use(self):
self.assertRaises(ImproperlyConfigured, lambda: reverse('account:register')) self.assertRaises(ImproperlyConfigured, lambda: reverse('account:register'))
class URLDisabledTests(URLTestCaseBase): class URLDisabledTests(URLTestCaseBase):
urls = 'regressiontests.i18n.patterns.urls.disabled' 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):
@ -82,7 +82,7 @@ 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 = 'regressiontests.i18n.patterns.urls.path_unused' 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/')

View File

@ -16,5 +16,5 @@ urlpatterns += i18n_patterns('',
url(r'^prefixed/$', view, name='prefixed'), url(r'^prefixed/$', view, name='prefixed'),
url(r'^prefixed\.xml$', view, name='prefixed_xml'), url(r'^prefixed\.xml$', view, name='prefixed_xml'),
url(_(r'^users/$'), view, name='users'), url(_(r'^users/$'), view, name='users'),
url(_(r'^account/'), include('regressiontests.i18n.patterns.urls.namespace', namespace='account')), url(_(r'^account/'), include('i18n.patterns.urls.namespace', namespace='account')),
) )

View File

@ -4,5 +4,5 @@ from django.utils.translation import ugettext_lazy as _
urlpatterns = i18n_patterns('', urlpatterns = i18n_patterns('',
url(_(r'^account/'), include('regressiontests.i18n.patterns.urls.wrong_namespace', namespace='account')), url(_(r'^account/'), include('i18n.patterns.urls.wrong_namespace', namespace='account')),
) )

View File

@ -696,8 +696,8 @@ class FormattingTests(TestCase):
with translation.override('de-at', deactivate=True): with translation.override('de-at', deactivate=True):
de_format_mod = import_module('django.conf.locale.de.formats') de_format_mod = import_module('django.conf.locale.de.formats')
self.assertEqual(list(iter_format_modules('de')), [de_format_mod]) self.assertEqual(list(iter_format_modules('de')), [de_format_mod])
with self.settings(FORMAT_MODULE_PATH='regressiontests.i18n.other.locale'): with self.settings(FORMAT_MODULE_PATH='i18n.other.locale'):
test_de_format_mod = import_module('regressiontests.i18n.other.locale.de.formats') test_de_format_mod = import_module('i18n.other.locale.de.formats')
self.assertEqual(list(iter_format_modules('de')), [test_de_format_mod, de_format_mod]) self.assertEqual(list(iter_format_modules('de')), [test_de_format_mod, de_format_mod])
def test_iter_format_modules_stability(self): def test_iter_format_modules_stability(self):
@ -714,7 +714,7 @@ class FormattingTests(TestCase):
self.assertEqual('.', get_format('DECIMAL_SEPARATOR', lang='en')) self.assertEqual('.', get_format('DECIMAL_SEPARATOR', lang='en'))
def test_get_format_modules_stability(self): def test_get_format_modules_stability(self):
with self.settings(FORMAT_MODULE_PATH='regressiontests.i18n.other.locale'): with self.settings(FORMAT_MODULE_PATH='i18n.other.locale'):
with translation.override('de', deactivate=True): with translation.override('de', deactivate=True):
old = str("%r") % get_format_modules(reverse=True) old = str("%r") % get_format_modules(reverse=True)
new = str("%r") % get_format_modules(reverse=True) # second try new = str("%r") % get_format_modules(reverse=True) # second try
@ -909,7 +909,7 @@ class AppResolutionOrderI18NTests(ResolutionOrderI18NTests):
def setUp(self): def setUp(self):
self.old_installed_apps = settings.INSTALLED_APPS self.old_installed_apps = settings.INSTALLED_APPS
settings.INSTALLED_APPS = ['regressiontests.i18n.resolution'] + list(settings.INSTALLED_APPS) settings.INSTALLED_APPS = ['i18n.resolution'] + list(settings.INSTALLED_APPS)
super(AppResolutionOrderI18NTests, self).setUp() super(AppResolutionOrderI18NTests, self).setUp()
def tearDown(self): def tearDown(self):
@ -926,7 +926,7 @@ class LocalePathsResolutionOrderI18NTests(ResolutionOrderI18NTests):
self.assertUgettext('Time', 'LOCALE_PATHS') self.assertUgettext('Time', 'LOCALE_PATHS')
def test_locale_paths_override_app_translation(self): def test_locale_paths_override_app_translation(self):
extended_apps = list(settings.INSTALLED_APPS) + ['regressiontests.i18n.resolution'] extended_apps = list(settings.INSTALLED_APPS) + ['i18n.resolution']
with self.settings(INSTALLED_APPS=extended_apps): with self.settings(INSTALLED_APPS=extended_apps):
self.assertUgettext('Time', 'LOCALE_PATHS') self.assertUgettext('Time', 'LOCALE_PATHS')

View File

@ -124,7 +124,7 @@ class InlineFormsetFactoryTest(TestCase):
to use for the inline formset, we should get an exception. to use for the inline formset, we should get an exception.
""" """
six.assertRaisesRegex(self, Exception, six.assertRaisesRegex(self, Exception,
"<class 'regressiontests.inline_formsets.models.Child'> has more than 1 ForeignKey to <class 'regressiontests.inline_formsets.models.Parent'>", "<class 'inline_formsets.models.Child'> has more than 1 ForeignKey to <class 'inline_formsets.models.Parent'>",
inlineformset_factory, Parent, Child inlineformset_factory, Parent, Child
) )
@ -134,7 +134,7 @@ class InlineFormsetFactoryTest(TestCase):
to the parent model, we should get an exception. to the parent model, we should get an exception.
""" """
self.assertRaises(Exception, self.assertRaises(Exception,
"fk_name 'school' is not a ForeignKey to <class 'regressiontests.inline_formsets.models.Parent'>", "fk_name 'school' is not a ForeignKey to <class 'inline_formsets.models.Parent'>",
inlineformset_factory, Parent, Child, fk_name='school' inlineformset_factory, Parent, Child, fk_name='school'
) )
@ -144,7 +144,7 @@ class InlineFormsetFactoryTest(TestCase):
exception. exception.
""" """
six.assertRaisesRegex(self, Exception, six.assertRaisesRegex(self, Exception,
"<class 'regressiontests.inline_formsets.models.Child'> has no field named 'test'", "<class 'inline_formsets.models.Child'> has no field named 'test'",
inlineformset_factory, Parent, Child, fk_name='test' inlineformset_factory, Parent, Child, fk_name='test'
) )

View File

@ -43,7 +43,7 @@ class InvalidModelTestCase(unittest.TestCase):
) )
def test_invalid_models(self): def test_invalid_models(self):
try: try:
module = load_app("modeltests.invalid_models.invalid_models") module = load_app("invalid_models.invalid_models")
except Exception: except Exception:
self.fail('Unable to load invalid model module') self.fail('Unable to load invalid model module')

View File

@ -14,7 +14,7 @@ from django.utils.log import CallbackFilter, RequireDebugFalse, RequireDebugTrue
from django.utils.six import StringIO from django.utils.six import StringIO
from django.utils.unittest import skipUnless from django.utils.unittest import skipUnless
from ..admin_scripts.tests import AdminScriptTestCase from admin_scripts.tests import AdminScriptTestCase
from .logconfig import MyEmailBackend from .logconfig import MyEmailBackend
@ -145,7 +145,7 @@ class AdminEmailHandlerTest(TestCase):
logger = logging.getLogger('django.request') logger = logging.getLogger('django.request')
def get_admin_email_handler(self, logger): def get_admin_email_handler(self, logger):
# Inspired from regressiontests/views/views.py: send_log() # Inspired from views/views.py: send_log()
# ensuring the AdminEmailHandler does not get filtered out # ensuring the AdminEmailHandler does not get filtered out
# even with DEBUG=True. # even with DEBUG=True.
admin_email_handler = [ admin_email_handler = [
@ -290,7 +290,7 @@ class AdminEmailHandlerTest(TestCase):
orig_email_backend = admin_email_handler.email_backend orig_email_backend = admin_email_handler.email_backend
mail.mail_admins = my_mail_admins mail.mail_admins = my_mail_admins
admin_email_handler.email_backend = ( admin_email_handler.email_backend = (
'regressiontests.logging_tests.logconfig.MyEmailBackend') 'logging_tests.logconfig.MyEmailBackend')
try: try:
self.logger.error(message) self.logger.error(message)
@ -341,5 +341,5 @@ class SettingsConfigureLogging(TestCase):
def test_configure_initializes_logging(self): def test_configure_initializes_logging(self):
settings = LazySettings() settings = LazySettings()
settings.configure( settings.configure(
LOGGING_CONFIG='regressiontests.logging_tests.tests.dictConfig') LOGGING_CONFIG='logging_tests.tests.dictConfig')
self.assertTrue(dictConfig.called) self.assertTrue(dictConfig.called)

View File

@ -243,7 +243,7 @@ class MailTests(TestCase):
def test_custom_backend(self): def test_custom_backend(self):
"""Test custom backend defined in this suite.""" """Test custom backend defined in this suite."""
conn = mail.get_connection('regressiontests.mail.custombackend.EmailBackend') conn = mail.get_connection('mail.custombackend.EmailBackend')
self.assertTrue(hasattr(conn, 'test_outbox')) self.assertTrue(hasattr(conn, 'test_outbox'))
email = EmailMessage('Subject', 'Content', 'bounce@example.com', ['to@example.com'], headers={'From': 'from@example.com'}) email = EmailMessage('Subject', 'Content', 'bounce@example.com', ['to@example.com'], headers={'From': 'from@example.com'})
conn.send_messages([email]) conn.send_messages([email])
@ -271,13 +271,13 @@ class MailTests(TestCase):
mail.outbox = [] mail.outbox = []
# Send using non-default connection # Send using non-default connection
connection = mail.get_connection('regressiontests.mail.custombackend.EmailBackend') connection = mail.get_connection('mail.custombackend.EmailBackend')
send_mail('Subject', 'Content', 'from@example.com', ['to@example.com'], connection=connection) send_mail('Subject', 'Content', 'from@example.com', ['to@example.com'], connection=connection)
self.assertEqual(mail.outbox, []) self.assertEqual(mail.outbox, [])
self.assertEqual(len(connection.test_outbox), 1) self.assertEqual(len(connection.test_outbox), 1)
self.assertEqual(connection.test_outbox[0].subject, 'Subject') self.assertEqual(connection.test_outbox[0].subject, 'Subject')
connection = mail.get_connection('regressiontests.mail.custombackend.EmailBackend') connection = mail.get_connection('mail.custombackend.EmailBackend')
send_mass_mail([ send_mass_mail([
('Subject1', 'Content1', 'from1@example.com', ['to1@example.com']), ('Subject1', 'Content1', 'from1@example.com', ['to1@example.com']),
('Subject2', 'Content2', 'from2@example.com', ['to2@example.com']), ('Subject2', 'Content2', 'from2@example.com', ['to2@example.com']),
@ -287,13 +287,13 @@ class MailTests(TestCase):
self.assertEqual(connection.test_outbox[0].subject, 'Subject1') self.assertEqual(connection.test_outbox[0].subject, 'Subject1')
self.assertEqual(connection.test_outbox[1].subject, 'Subject2') self.assertEqual(connection.test_outbox[1].subject, 'Subject2')
connection = mail.get_connection('regressiontests.mail.custombackend.EmailBackend') connection = mail.get_connection('mail.custombackend.EmailBackend')
mail_admins('Admin message', 'Content', connection=connection) mail_admins('Admin message', 'Content', connection=connection)
self.assertEqual(mail.outbox, []) self.assertEqual(mail.outbox, [])
self.assertEqual(len(connection.test_outbox), 1) self.assertEqual(len(connection.test_outbox), 1)
self.assertEqual(connection.test_outbox[0].subject, '[Django] Admin message') self.assertEqual(connection.test_outbox[0].subject, '[Django] Admin message')
connection = mail.get_connection('regressiontests.mail.custombackend.EmailBackend') connection = mail.get_connection('mail.custombackend.EmailBackend')
mail_managers('Manager message', 'Content', connection=connection) mail_managers('Manager message', 'Content', connection=connection)
self.assertEqual(mail.outbox, []) self.assertEqual(mail.outbox, [])
self.assertEqual(len(connection.test_outbox), 1) self.assertEqual(len(connection.test_outbox), 1)

View File

@ -139,7 +139,7 @@ class CommonMiddlewareTest(TestCase):
Tests that URLs with slashes go unmolested. Tests that URLs with slashes go unmolested.
""" """
request = self._get_request('customurlconf/slash/') request = self._get_request('customurlconf/slash/')
request.urlconf = 'regressiontests.middleware.extra_urls' request.urlconf = 'middleware.extra_urls'
self.assertEqual(CommonMiddleware().process_request(request), None) self.assertEqual(CommonMiddleware().process_request(request), None)
@override_settings(APPEND_SLASH=True) @override_settings(APPEND_SLASH=True)
@ -148,7 +148,7 @@ class CommonMiddlewareTest(TestCase):
Tests that matches to explicit slashless URLs go unmolested. Tests that matches to explicit slashless URLs go unmolested.
""" """
request = self._get_request('customurlconf/noslash') request = self._get_request('customurlconf/noslash')
request.urlconf = 'regressiontests.middleware.extra_urls' request.urlconf = 'middleware.extra_urls'
self.assertEqual(CommonMiddleware().process_request(request), None) self.assertEqual(CommonMiddleware().process_request(request), None)
@override_settings(APPEND_SLASH=True) @override_settings(APPEND_SLASH=True)
@ -157,7 +157,7 @@ class CommonMiddlewareTest(TestCase):
Tests that APPEND_SLASH doesn't redirect to unknown resources. Tests that APPEND_SLASH doesn't redirect to unknown resources.
""" """
request = self._get_request('customurlconf/unknown') request = self._get_request('customurlconf/unknown')
request.urlconf = 'regressiontests.middleware.extra_urls' request.urlconf = 'middleware.extra_urls'
self.assertEqual(CommonMiddleware().process_request(request), None) self.assertEqual(CommonMiddleware().process_request(request), None)
@override_settings(APPEND_SLASH=True) @override_settings(APPEND_SLASH=True)
@ -166,7 +166,7 @@ class CommonMiddlewareTest(TestCase):
Tests that APPEND_SLASH redirects slashless URLs to a valid pattern. Tests that APPEND_SLASH redirects slashless URLs to a valid pattern.
""" """
request = self._get_request('customurlconf/slash') request = self._get_request('customurlconf/slash')
request.urlconf = 'regressiontests.middleware.extra_urls' request.urlconf = 'middleware.extra_urls'
r = CommonMiddleware().process_request(request) r = CommonMiddleware().process_request(request)
self.assertFalse(r is None, self.assertFalse(r is None,
"CommonMiddlware failed to return APPEND_SLASH redirect using request.urlconf") "CommonMiddlware failed to return APPEND_SLASH redirect using request.urlconf")
@ -181,7 +181,7 @@ class CommonMiddlewareTest(TestCase):
redirected to a slashed version. redirected to a slashed version.
""" """
request = self._get_request('customurlconf/slash') request = self._get_request('customurlconf/slash')
request.urlconf = 'regressiontests.middleware.extra_urls' request.urlconf = 'middleware.extra_urls'
request.method = 'POST' request.method = 'POST'
with six.assertRaisesRegex(self, RuntimeError, 'end in a slash'): with six.assertRaisesRegex(self, RuntimeError, 'end in a slash'):
CommonMiddleware().process_request(request) CommonMiddleware().process_request(request)
@ -192,7 +192,7 @@ class CommonMiddlewareTest(TestCase):
Tests disabling append slash functionality. Tests disabling append slash functionality.
""" """
request = self._get_request('customurlconf/slash') request = self._get_request('customurlconf/slash')
request.urlconf = 'regressiontests.middleware.extra_urls' request.urlconf = 'middleware.extra_urls'
self.assertEqual(CommonMiddleware().process_request(request), None) self.assertEqual(CommonMiddleware().process_request(request), None)
@override_settings(APPEND_SLASH=True) @override_settings(APPEND_SLASH=True)
@ -202,7 +202,7 @@ class CommonMiddlewareTest(TestCase):
version ok. version ok.
""" """
request = self._get_request('customurlconf/needsquoting#') request = self._get_request('customurlconf/needsquoting#')
request.urlconf = 'regressiontests.middleware.extra_urls' request.urlconf = 'middleware.extra_urls'
r = CommonMiddleware().process_request(request) r = CommonMiddleware().process_request(request)
self.assertFalse(r is None, self.assertFalse(r is None,
"CommonMiddlware failed to return APPEND_SLASH redirect using request.urlconf") "CommonMiddlware failed to return APPEND_SLASH redirect using request.urlconf")
@ -214,7 +214,7 @@ class CommonMiddlewareTest(TestCase):
@override_settings(APPEND_SLASH=False, PREPEND_WWW=True) @override_settings(APPEND_SLASH=False, PREPEND_WWW=True)
def test_prepend_www_custom_urlconf(self): def test_prepend_www_custom_urlconf(self):
request = self._get_request('customurlconf/path/') request = self._get_request('customurlconf/path/')
request.urlconf = 'regressiontests.middleware.extra_urls' request.urlconf = 'middleware.extra_urls'
r = CommonMiddleware().process_request(request) r = CommonMiddleware().process_request(request)
self.assertEqual(r.status_code, 301) self.assertEqual(r.status_code, 301)
self.assertEqual( self.assertEqual(
@ -224,7 +224,7 @@ class CommonMiddlewareTest(TestCase):
@override_settings(APPEND_SLASH=True, PREPEND_WWW=True) @override_settings(APPEND_SLASH=True, PREPEND_WWW=True)
def test_prepend_www_append_slash_have_slash_custom_urlconf(self): def test_prepend_www_append_slash_have_slash_custom_urlconf(self):
request = self._get_request('customurlconf/slash/') request = self._get_request('customurlconf/slash/')
request.urlconf = 'regressiontests.middleware.extra_urls' request.urlconf = 'middleware.extra_urls'
r = CommonMiddleware().process_request(request) r = CommonMiddleware().process_request(request)
self.assertEqual(r.status_code, 301) self.assertEqual(r.status_code, 301)
self.assertEqual(r.url, self.assertEqual(r.url,
@ -233,7 +233,7 @@ class CommonMiddlewareTest(TestCase):
@override_settings(APPEND_SLASH=True, PREPEND_WWW=True) @override_settings(APPEND_SLASH=True, PREPEND_WWW=True)
def test_prepend_www_append_slash_slashless_custom_urlconf(self): def test_prepend_www_append_slash_slashless_custom_urlconf(self):
request = self._get_request('customurlconf/slash') request = self._get_request('customurlconf/slash')
request.urlconf = 'regressiontests.middleware.extra_urls' request.urlconf = 'middleware.extra_urls'
r = CommonMiddleware().process_request(request) r = CommonMiddleware().process_request(request)
self.assertEqual(r.status_code, 301) self.assertEqual(r.status_code, 301)
self.assertEqual(r.url, self.assertEqual(r.url,
@ -313,7 +313,7 @@ class BrokenLinkEmailsMiddlewareTest(TestCase):
class ConditionalGetMiddlewareTest(TestCase): class ConditionalGetMiddlewareTest(TestCase):
urls = 'regressiontests.middleware.cond_get_urls' urls = 'middleware.cond_get_urls'
def setUp(self): def setUp(self):
self.req = HttpRequest() self.req = HttpRequest()
self.req.META = { self.req.META = {

View File

@ -94,7 +94,7 @@ class BadExceptionMiddleware(TestMiddleware):
class BaseMiddlewareExceptionTest(TestCase): class BaseMiddlewareExceptionTest(TestCase):
urls = 'regressiontests.middleware_exceptions.urls' urls = 'middleware_exceptions.urls'
def setUp(self): def setUp(self):
self.exceptions = [] self.exceptions = []
@ -374,7 +374,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(middleware) self._add_middleware(middleware)
self._add_middleware(pre_middleware) self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/null_view/', [ self.assert_exceptions_handled('/middleware_exceptions/null_view/', [
"The view regressiontests.middleware_exceptions.views.null_view didn't return an HttpResponse object.", "The view middleware_exceptions.views.null_view didn't return an HttpResponse object.",
], ],
ValueError()) ValueError())
@ -391,7 +391,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(middleware) self._add_middleware(middleware)
self._add_middleware(pre_middleware) self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/null_view/', [ self.assert_exceptions_handled('/middleware_exceptions/null_view/', [
"The view regressiontests.middleware_exceptions.views.null_view didn't return an HttpResponse object." "The view middleware_exceptions.views.null_view didn't return an HttpResponse object."
], ],
ValueError()) ValueError())
@ -685,7 +685,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(bad_middleware) self._add_middleware(bad_middleware)
self._add_middleware(pre_middleware) self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/null_view/', [ self.assert_exceptions_handled('/middleware_exceptions/null_view/', [
"The view regressiontests.middleware_exceptions.views.null_view didn't return an HttpResponse object.", "The view middleware_exceptions.views.null_view didn't return an HttpResponse object.",
'Test Response Exception' 'Test Response Exception'
]) ])
@ -702,7 +702,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
self._add_middleware(bad_middleware) self._add_middleware(bad_middleware)
self._add_middleware(pre_middleware) self._add_middleware(pre_middleware)
self.assert_exceptions_handled('/middleware_exceptions/null_view/', [ self.assert_exceptions_handled('/middleware_exceptions/null_view/', [
"The view regressiontests.middleware_exceptions.views.null_view didn't return an HttpResponse object." "The view middleware_exceptions.views.null_view didn't return an HttpResponse object."
], ],
ValueError()) ValueError())
@ -770,7 +770,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest):
_missing = object() _missing = object()
class RootUrlconfTests(TestCase): class RootUrlconfTests(TestCase):
urls = 'regressiontests.middleware_exceptions.urls' urls = 'middleware_exceptions.urls'
def test_missing_root_urlconf(self): def test_missing_root_urlconf(self):
try: try:

View File

@ -10,7 +10,7 @@ from __future__ import absolute_import
from django.db import models from django.db import models
from ..model_inheritance.models import NamedURL from model_inheritance.models import NamedURL
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible
# #

View File

@ -2,7 +2,7 @@ from __future__ import absolute_import
from django.test import TestCase from django.test import TestCase
from ..model_inheritance.models import Title from model_inheritance.models import Title
class InheritanceSameModelNameTests(TestCase): class InheritanceSameModelNameTests(TestCase):
@ -14,7 +14,7 @@ class InheritanceSameModelNameTests(TestCase):
self.title = Title.objects.create(title='Lorem Ipsum') self.title = Title.objects.create(title='Lorem Ipsum')
def test_inheritance_related_name(self): def test_inheritance_related_name(self):
from modeltests.model_inheritance.models import Copy from model_inheritance.models import Copy
self.assertEqual( self.assertEqual(
self.title.attached_model_inheritance_copy_set.create( self.title.attached_model_inheritance_copy_set.create(
content='Save $ on V1agr@', content='Save $ on V1agr@',
@ -23,7 +23,7 @@ class InheritanceSameModelNameTests(TestCase):
), Copy.objects.get(content='Save $ on V1agr@')) ), Copy.objects.get(content='Save $ on V1agr@'))
def test_inheritance_with_same_model_name(self): def test_inheritance_with_same_model_name(self):
from modeltests.model_inheritance_same_model_name.models import Copy from model_inheritance_same_model_name.models import Copy
self.assertEqual( self.assertEqual(
self.title.attached_model_inheritance_same_model_name_copy_set.create( self.title.attached_model_inheritance_same_model_name_copy_set.create(
content='The Web framework for perfectionists with deadlines.', content='The Web framework for perfectionists with deadlines.',

View File

@ -6,7 +6,7 @@ from .models import Guitarist
class PermalinkTests(TestCase): class PermalinkTests(TestCase):
urls = 'regressiontests.model_permalink.urls' 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')

View File

@ -18,7 +18,7 @@ CONTRIB_DIR = os.path.dirname(upath(contrib.__file__))
TEMP_DIR = tempfile.mkdtemp(prefix='django_') TEMP_DIR = tempfile.mkdtemp(prefix='django_')
os.environ['DJANGO_TEST_TEMP_DIR'] = TEMP_DIR os.environ['DJANGO_TEST_TEMP_DIR'] = TEMP_DIR
SUBDIRS_TO_SKIP = ['test_templates'] SUBDIRS_TO_SKIP = ['templates']
ALWAYS_INSTALLED_APPS = [ ALWAYS_INSTALLED_APPS = [
'django.contrib.contenttypes', 'django.contrib.contenttypes',
@ -54,7 +54,8 @@ def get_test_modules():
# Python 3 byte code dirs (PEP 3147) # Python 3 byte code dirs (PEP 3147)
f == '__pycache__' or f == '__pycache__' or
f.startswith('sql') or f.startswith('sql') or
os.path.basename(f) in SUBDIRS_TO_SKIP): os.path.basename(f) in SUBDIRS_TO_SKIP or
os.path.isfile(f)):
continue continue
modules.append((loc, f)) modules.append((loc, f))
return modules return modules

View File

@ -30,7 +30,7 @@ TEST_SETTINGS = {
class LiveServerBase(LiveServerTestCase): class LiveServerBase(LiveServerTestCase):
urls = 'regressiontests.servers.urls' urls = 'servers.urls'
fixtures = ['testdata.json'] fixtures = ['testdata.json']
@classmethod @classmethod

View File

@ -6,7 +6,7 @@ from django.test.utils import override_settings
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) @override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class SpecialHeadersTest(TestCase): class SpecialHeadersTest(TestCase):
fixtures = ['data.xml'] fixtures = ['data.xml']
urls = 'regressiontests.special_headers.urls' urls = 'special_headers.urls'
def test_xheaders(self): def test_xheaders(self):
user = User.objects.get(username='super') user = User.objects.get(username='super')
@ -32,7 +32,7 @@ class SpecialHeadersTest(TestCase):
self.client.login(username='super', password='secret') self.client.login(username='super', password='secret')
response = self.client.head('/special_headers/xview/func/') response = self.client.head('/special_headers/xview/func/')
self.assertTrue('X-View' in response) self.assertTrue('X-View' in response)
self.assertEqual(response['X-View'], 'regressiontests.special_headers.views.xview') self.assertEqual(response['X-View'], 'special_headers.views.xview')
user.is_staff = False user.is_staff = False
user.save() user.save()
response = self.client.head('/special_headers/xview/func/') response = self.client.head('/special_headers/xview/func/')
@ -50,7 +50,7 @@ class SpecialHeadersTest(TestCase):
self.client.login(username='super', password='secret') self.client.login(username='super', password='secret')
response = self.client.head('/special_headers/xview/class/') response = self.client.head('/special_headers/xview/class/')
self.assertTrue('X-View' in response) self.assertTrue('X-View' in response)
self.assertEqual(response['X-View'], 'regressiontests.special_headers.views.XViewClass') self.assertEqual(response['X-View'], 'special_headers.views.XViewClass')
user.is_staff = False user.is_staff = False
user.save() user.save()
response = self.client.head('/special_headers/xview/class/') response = self.client.head('/special_headers/xview/class/')

View File

@ -299,8 +299,8 @@ class TestCollectionFilesOverride(CollectionTestCase):
Check for proper handling of apps order in INSTALLED_APPS even if file modification Check for proper handling of apps order in INSTALLED_APPS even if file modification
dates are in different order: dates are in different order:
'regressiontests.staticfiles_tests.apps.test', 'staticfiles_tests.apps.test',
'regressiontests.staticfiles_tests.apps.no_label', 'staticfiles_tests.apps.no_label',
""" """
def setUp(self): def setUp(self):
@ -350,7 +350,7 @@ class TestCollectionFilesOverride(CollectionTestCase):
@override_settings( @override_settings(
STATICFILES_STORAGE='regressiontests.staticfiles_tests.storage.DummyStorage', STATICFILES_STORAGE='staticfiles_tests.storage.DummyStorage',
) )
class TestCollectionNonLocalStorage(CollectionTestCase, TestNoFilesCreated): class TestCollectionNonLocalStorage(CollectionTestCase, TestNoFilesCreated):
""" """
@ -553,7 +553,7 @@ class TestCollectionCachedStorage(BaseCollectionTestCase,
# we set DEBUG to False here since the template tag wouldn't work otherwise # we set DEBUG to False here since the template tag wouldn't work otherwise
@override_settings(**dict(TEST_SETTINGS, @override_settings(**dict(TEST_SETTINGS,
STATICFILES_STORAGE='regressiontests.staticfiles_tests.storage.SimpleCachedStaticFilesStorage', STATICFILES_STORAGE='staticfiles_tests.storage.SimpleCachedStaticFilesStorage',
DEBUG=False, DEBUG=False,
)) ))
class TestCollectionSimpleCachedStorage(BaseCollectionTestCase, class TestCollectionSimpleCachedStorage(BaseCollectionTestCase,
@ -613,7 +613,7 @@ class TestServeStatic(StaticFilesTestCase):
""" """
Test static asset serving view. Test static asset serving view.
""" """
urls = 'regressiontests.staticfiles_tests.urls.default' urls = 'staticfiles_tests.urls.default'
def _response(self, filepath): def _response(self, filepath):
return self.client.get( return self.client.get(
@ -650,7 +650,7 @@ class TestServeStaticWithURLHelper(TestServeStatic, TestDefaults):
""" """
Test static asset serving view with staticfiles_urlpatterns helper. Test static asset serving view with staticfiles_urlpatterns helper.
""" """
urls = 'regressiontests.staticfiles_tests.urls.helper' urls = 'staticfiles_tests.urls.helper'
class TestServeAdminMedia(TestServeStatic): class TestServeAdminMedia(TestServeStatic):

View File

@ -9,7 +9,7 @@ from django.db.models.loading import cache
from django.test import TestCase from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings
from regressiontests.swappable_models.models import Article from swappable_models.models import Article
class SwappableModelTests(TestCase): class SwappableModelTests(TestCase):

View File

@ -35,7 +35,7 @@ class SyndicationFeedTest(FeedTestCase):
""" """
Tests for the high-level syndication feed framework. Tests for the high-level syndication feed framework.
""" """
urls = 'regressiontests.syndication.urls' urls = 'syndication.urls'
def test_rss2_feed(self): def test_rss2_feed(self):
""" """

View File

@ -15,13 +15,13 @@ from django.utils._os import upath
def test_processor(request): def test_processor(request):
return {'processors': 'yes'} return {'processors': 'yes'}
test_processor_name = 'regressiontests.templates.response.test_processor' test_processor_name = 'template_tests.response.test_processor'
# A test middleware that installs a temporary URLConf # A test middleware that installs a temporary URLConf
class CustomURLConfMiddleware(object): class CustomURLConfMiddleware(object):
def process_request(self, request): def process_request(self, request):
request.urlconf = 'regressiontests.templates.alternate_urls' request.urlconf = 'template_tests.alternate_urls'
class SimpleTemplateResponseTest(TestCase): class SimpleTemplateResponseTest(TestCase):
@ -298,12 +298,12 @@ class TemplateResponseTest(TestCase):
class CustomURLConfTest(TestCase): class CustomURLConfTest(TestCase):
urls = 'regressiontests.templates.urls' urls = 'template_tests.urls'
def setUp(self): def setUp(self):
self.old_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES self.old_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES
settings.MIDDLEWARE_CLASSES = list(settings.MIDDLEWARE_CLASSES) + [ settings.MIDDLEWARE_CLASSES = list(settings.MIDDLEWARE_CLASSES) + [
'regressiontests.templates.response.CustomURLConfMiddleware' 'template_tests.response.CustomURLConfMiddleware'
] ]
def tearDown(self): def tearDown(self):
@ -316,7 +316,7 @@ class CustomURLConfTest(TestCase):
class CacheMiddlewareTest(TestCase): class CacheMiddlewareTest(TestCase):
urls = 'regressiontests.templates.alternate_urls' urls = 'template_tests.alternate_urls'
def setUp(self): def setUp(self):
self.old_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES self.old_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES

View File

@ -482,7 +482,7 @@ class Templates(TestCase):
# Warm the URL reversing cache. This ensures we don't pay the cost # Warm the URL reversing cache. This ensures we don't pay the cost
# warming the cache during one of the tests. # warming the cache during one of the tests.
urlresolvers.reverse('regressiontests.templates.views.client_action', urlresolvers.reverse('template_tests.views.client_action',
kwargs={'id':0,'action':"update"}) kwargs={'id':0,'action':"update"})
for name, vals in tests: for name, vals in tests:
@ -1595,33 +1595,33 @@ class Templates(TestCase):
### URL TAG ######################################################## ### URL TAG ########################################################
# Successes # Successes
'url01': ('{% url "regressiontests.templates.views.client" client.id %}', {'client': {'id': 1}}, '/url_tag/client/1/'), 'url01': ('{% url "template_tests.views.client" client.id %}', {'client': {'id': 1}}, '/url_tag/client/1/'),
'url02': ('{% url "regressiontests.templates.views.client_action" id=client.id action="update" %}', {'client': {'id': 1}}, '/url_tag/client/1/update/'), 'url02': ('{% url "template_tests.views.client_action" id=client.id action="update" %}', {'client': {'id': 1}}, '/url_tag/client/1/update/'),
'url02a': ('{% url "regressiontests.templates.views.client_action" client.id "update" %}', {'client': {'id': 1}}, '/url_tag/client/1/update/'), 'url02a': ('{% url "template_tests.views.client_action" client.id "update" %}', {'client': {'id': 1}}, '/url_tag/client/1/update/'),
'url02b': ("{% url 'regressiontests.templates.views.client_action' id=client.id action='update' %}", {'client': {'id': 1}}, '/url_tag/client/1/update/'), 'url02b': ("{% url 'template_tests.views.client_action' id=client.id action='update' %}", {'client': {'id': 1}}, '/url_tag/client/1/update/'),
'url02c': ("{% url 'regressiontests.templates.views.client_action' client.id 'update' %}", {'client': {'id': 1}}, '/url_tag/client/1/update/'), 'url02c': ("{% url 'template_tests.views.client_action' client.id 'update' %}", {'client': {'id': 1}}, '/url_tag/client/1/update/'),
'url03': ('{% url "regressiontests.templates.views.index" %}', {}, '/url_tag/'), 'url03': ('{% url "template_tests.views.index" %}', {}, '/url_tag/'),
'url04': ('{% url "named.client" client.id %}', {'client': {'id': 1}}, '/url_tag/named-client/1/'), 'url04': ('{% url "named.client" client.id %}', {'client': {'id': 1}}, '/url_tag/named-client/1/'),
'url05': ('{% url "метка_оператора" v %}', {'v': 'Ω'}, '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'), 'url05': ('{% url "метка_оператора" v %}', {'v': 'Ω'}, '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'),
'url06': ('{% url "метка_оператора_2" tag=v %}', {'v': 'Ω'}, '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'), 'url06': ('{% url "метка_оператора_2" tag=v %}', {'v': 'Ω'}, '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'),
'url07': ('{% url "regressiontests.templates.views.client2" tag=v %}', {'v': 'Ω'}, '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'), 'url07': ('{% url "template_tests.views.client2" tag=v %}', {'v': 'Ω'}, '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'),
'url08': ('{% url "метка_оператора" v %}', {'v': 'Ω'}, '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'), 'url08': ('{% url "метка_оператора" v %}', {'v': 'Ω'}, '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'),
'url09': ('{% url "метка_оператора_2" tag=v %}', {'v': 'Ω'}, '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'), 'url09': ('{% url "метка_оператора_2" tag=v %}', {'v': 'Ω'}, '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'),
'url10': ('{% url "regressiontests.templates.views.client_action" id=client.id action="two words" %}', {'client': {'id': 1}}, '/url_tag/client/1/two%20words/'), 'url10': ('{% url "template_tests.views.client_action" id=client.id action="two words" %}', {'client': {'id': 1}}, '/url_tag/client/1/two%20words/'),
'url11': ('{% url "regressiontests.templates.views.client_action" id=client.id action="==" %}', {'client': {'id': 1}}, '/url_tag/client/1/==/'), 'url11': ('{% url "template_tests.views.client_action" id=client.id action="==" %}', {'client': {'id': 1}}, '/url_tag/client/1/==/'),
'url12': ('{% url "regressiontests.templates.views.client_action" id=client.id action="," %}', {'client': {'id': 1}}, '/url_tag/client/1/,/'), 'url12': ('{% url "template_tests.views.client_action" id=client.id action="," %}', {'client': {'id': 1}}, '/url_tag/client/1/,/'),
'url13': ('{% url "regressiontests.templates.views.client_action" id=client.id action=arg|join:"-" %}', {'client': {'id': 1}, 'arg':['a','b']}, '/url_tag/client/1/a-b/'), 'url13': ('{% url "template_tests.views.client_action" id=client.id action=arg|join:"-" %}', {'client': {'id': 1}, 'arg':['a','b']}, '/url_tag/client/1/a-b/'),
'url14': ('{% url "regressiontests.templates.views.client_action" client.id arg|join:"-" %}', {'client': {'id': 1}, 'arg':['a','b']}, '/url_tag/client/1/a-b/'), 'url14': ('{% url "template_tests.views.client_action" client.id arg|join:"-" %}', {'client': {'id': 1}, 'arg':['a','b']}, '/url_tag/client/1/a-b/'),
'url15': ('{% url "regressiontests.templates.views.client_action" 12 "test" %}', {}, '/url_tag/client/12/test/'), 'url15': ('{% url "template_tests.views.client_action" 12 "test" %}', {}, '/url_tag/client/12/test/'),
'url18': ('{% url "regressiontests.templates.views.client" "1,2" %}', {}, '/url_tag/client/1,2/'), 'url18': ('{% url "template_tests.views.client" "1,2" %}', {}, '/url_tag/client/1,2/'),
'url19': ('{% url named_url client.id %}', {'named_url': 'regressiontests.templates.views.client', 'client': {'id': 1}}, '/url_tag/client/1/'), 'url19': ('{% url named_url client.id %}', {'named_url': 'template_tests.views.client', 'client': {'id': 1}}, '/url_tag/client/1/'),
'url20': ('{% url url_name_in_var client.id %}', {'url_name_in_var': 'named.client', 'client': {'id': 1}}, '/url_tag/named-client/1/'), 'url20': ('{% url url_name_in_var client.id %}', {'url_name_in_var': 'named.client', 'client': {'id': 1}}, '/url_tag/named-client/1/'),
# Failures # Failures
'url-fail01': ('{% url %}', {}, template.TemplateSyntaxError), 'url-fail01': ('{% url %}', {}, template.TemplateSyntaxError),
'url-fail02': ('{% url "no_such_view" %}', {}, (urlresolvers.NoReverseMatch, urlresolvers.NoReverseMatch)), 'url-fail02': ('{% url "no_such_view" %}', {}, (urlresolvers.NoReverseMatch, urlresolvers.NoReverseMatch)),
'url-fail03': ('{% url "regressiontests.templates.views.client" %}', {}, (urlresolvers.NoReverseMatch, urlresolvers.NoReverseMatch)), 'url-fail03': ('{% url "template_tests.views.client" %}', {}, (urlresolvers.NoReverseMatch, urlresolvers.NoReverseMatch)),
'url-fail04': ('{% url "view" id, %}', {}, template.TemplateSyntaxError), 'url-fail04': ('{% url "view" id, %}', {}, template.TemplateSyntaxError),
'url-fail05': ('{% url "view" id= %}', {}, template.TemplateSyntaxError), 'url-fail05': ('{% url "view" id= %}', {}, template.TemplateSyntaxError),
'url-fail06': ('{% url "view" a.id=id %}', {}, template.TemplateSyntaxError), 'url-fail06': ('{% url "view" a.id=id %}', {}, template.TemplateSyntaxError),
@ -1631,7 +1631,7 @@ class Templates(TestCase):
'url-fail11': ('{% url named_url %}', {}, (urlresolvers.NoReverseMatch, urlresolvers.NoReverseMatch)), 'url-fail11': ('{% url named_url %}', {}, (urlresolvers.NoReverseMatch, urlresolvers.NoReverseMatch)),
'url-fail12': ('{% url named_url %}', {'named_url': 'no_such_view'}, (urlresolvers.NoReverseMatch, urlresolvers.NoReverseMatch)), 'url-fail12': ('{% url named_url %}', {'named_url': 'no_such_view'}, (urlresolvers.NoReverseMatch, urlresolvers.NoReverseMatch)),
'url-fail13': ('{% url named_url %}', {'named_url': 'regressiontests.templates.views.client'}, (urlresolvers.NoReverseMatch, urlresolvers.NoReverseMatch)), 'url-fail13': ('{% url named_url %}', {'named_url': 'template_tests.views.client'}, (urlresolvers.NoReverseMatch, urlresolvers.NoReverseMatch)),
'url-fail14': ('{% url named_url id, %}', {'named_url': 'view'}, template.TemplateSyntaxError), 'url-fail14': ('{% url named_url id, %}', {'named_url': 'view'}, template.TemplateSyntaxError),
'url-fail15': ('{% url named_url id= %}', {'named_url': 'view'}, template.TemplateSyntaxError), 'url-fail15': ('{% url named_url id= %}', {'named_url': 'view'}, template.TemplateSyntaxError),
'url-fail16': ('{% url named_url a.id=id %}', {'named_url': 'view'}, template.TemplateSyntaxError), 'url-fail16': ('{% url named_url a.id=id %}', {'named_url': 'view'}, template.TemplateSyntaxError),
@ -1640,8 +1640,8 @@ class Templates(TestCase):
'url-fail19': ('{% url named_url id=", %}', {'named_url': 'view'}, template.TemplateSyntaxError), 'url-fail19': ('{% url named_url id=", %}', {'named_url': 'view'}, template.TemplateSyntaxError),
# {% url ... as var %} # {% url ... as var %}
'url-asvar01': ('{% url "regressiontests.templates.views.index" as url %}', {}, ''), 'url-asvar01': ('{% url "template_tests.views.index" as url %}', {}, ''),
'url-asvar02': ('{% url "regressiontests.templates.views.index" as url %}{{ url }}', {}, '/url_tag/'), 'url-asvar02': ('{% url "template_tests.views.index" as url %}{{ url }}', {}, '/url_tag/'),
'url-asvar03': ('{% url "no_such_view" as url %}{{ url }}', {}, ''), 'url-asvar03': ('{% url "no_such_view" as url %}{{ url }}', {}, ''),
### CACHE TAG ###################################################### ### CACHE TAG ######################################################

Some files were not shown because too many files have changed in this diff Show More