From 89f40e36246100df6a11316c31a76712ebc6c501 Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Tue, 26 Feb 2013 09:53:47 +0100 Subject: Merged regressiontests and modeltests into the test root. --- tests/admin_scripts/__init__.py | 0 tests/admin_scripts/app_with_import/__init__.py | 0 tests/admin_scripts/app_with_import/models.py | 8 + tests/admin_scripts/broken_app/__init__.py | 0 tests/admin_scripts/broken_app/models.py | 1 + tests/admin_scripts/complex_app/__init__.py | 0 tests/admin_scripts/complex_app/admin/__init__.py | 0 tests/admin_scripts/complex_app/admin/foo.py | 8 + tests/admin_scripts/complex_app/models/__init__.py | 4 + tests/admin_scripts/complex_app/models/bar.py | 11 + tests/admin_scripts/complex_app/models/foo.py | 7 + .../custom_templates/app_template/__init__.py | 0 .../custom_templates/app_template/api.py | 1 + .../custom_templates/app_template/models.py | 1 + .../custom_templates/project_template.tgz | Bin 0 -> 164 bytes .../project_template/additional_dir/Procfile | 1 + .../additional_dir/additional_file.py | 1 + .../project_template/additional_dir/extra.py | 1 + .../additional_dir/requirements.txt | 1 + .../custom_templates/project_template/manage.py | 6 + .../project_template/project_name/__init__.py | 0 .../project_template/project_name/settings.py | 1 + .../ticket-18091-non-ascii-template.txt | 2 + .../project_template/ticket-19397-binary-file.ico | Bin 0 -> 894 bytes tests/admin_scripts/management/__init__.py | 0 .../admin_scripts/management/commands/__init__.py | 0 .../management/commands/app_command.py | 11 + .../management/commands/base_command.py | 17 + .../management/commands/custom_startproject.py | 11 + .../management/commands/label_command.py | 10 + .../management/commands/noargs_command.py | 10 + tests/admin_scripts/models.py | 14 + tests/admin_scripts/simple_app/__init__.py | 0 tests/admin_scripts/simple_app/models.py | 3 + tests/admin_scripts/tests.py | 1649 ++++++++++++++++++++ tests/admin_scripts/urls.py | 11 + 36 files changed, 1790 insertions(+) create mode 100644 tests/admin_scripts/__init__.py create mode 100644 tests/admin_scripts/app_with_import/__init__.py create mode 100644 tests/admin_scripts/app_with_import/models.py create mode 100644 tests/admin_scripts/broken_app/__init__.py create mode 100644 tests/admin_scripts/broken_app/models.py create mode 100644 tests/admin_scripts/complex_app/__init__.py create mode 100644 tests/admin_scripts/complex_app/admin/__init__.py create mode 100644 tests/admin_scripts/complex_app/admin/foo.py create mode 100644 tests/admin_scripts/complex_app/models/__init__.py create mode 100644 tests/admin_scripts/complex_app/models/bar.py create mode 100644 tests/admin_scripts/complex_app/models/foo.py create mode 100644 tests/admin_scripts/custom_templates/app_template/__init__.py create mode 100644 tests/admin_scripts/custom_templates/app_template/api.py create mode 100644 tests/admin_scripts/custom_templates/app_template/models.py create mode 100644 tests/admin_scripts/custom_templates/project_template.tgz create mode 100644 tests/admin_scripts/custom_templates/project_template/additional_dir/Procfile create mode 100644 tests/admin_scripts/custom_templates/project_template/additional_dir/additional_file.py create mode 100644 tests/admin_scripts/custom_templates/project_template/additional_dir/extra.py create mode 100644 tests/admin_scripts/custom_templates/project_template/additional_dir/requirements.txt create mode 100755 tests/admin_scripts/custom_templates/project_template/manage.py create mode 100644 tests/admin_scripts/custom_templates/project_template/project_name/__init__.py create mode 100644 tests/admin_scripts/custom_templates/project_template/project_name/settings.py create mode 100644 tests/admin_scripts/custom_templates/project_template/ticket-18091-non-ascii-template.txt create mode 100644 tests/admin_scripts/custom_templates/project_template/ticket-19397-binary-file.ico create mode 100644 tests/admin_scripts/management/__init__.py create mode 100644 tests/admin_scripts/management/commands/__init__.py create mode 100644 tests/admin_scripts/management/commands/app_command.py create mode 100644 tests/admin_scripts/management/commands/base_command.py create mode 100644 tests/admin_scripts/management/commands/custom_startproject.py create mode 100644 tests/admin_scripts/management/commands/label_command.py create mode 100644 tests/admin_scripts/management/commands/noargs_command.py create mode 100644 tests/admin_scripts/models.py create mode 100644 tests/admin_scripts/simple_app/__init__.py create mode 100644 tests/admin_scripts/simple_app/models.py create mode 100644 tests/admin_scripts/tests.py create mode 100644 tests/admin_scripts/urls.py (limited to 'tests/admin_scripts') diff --git a/tests/admin_scripts/__init__.py b/tests/admin_scripts/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/admin_scripts/app_with_import/__init__.py b/tests/admin_scripts/app_with_import/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/admin_scripts/app_with_import/models.py b/tests/admin_scripts/app_with_import/models.py new file mode 100644 index 0000000000..17a892bd17 --- /dev/null +++ b/tests/admin_scripts/app_with_import/models.py @@ -0,0 +1,8 @@ +from django.db import models +from django.contrib.comments.models import Comment + + +# Regression for #13368. This is an example of a model +# that imports a class that has an abstract base class. +class CommentScore(models.Model): + comment = models.OneToOneField(Comment, primary_key=True) diff --git a/tests/admin_scripts/broken_app/__init__.py b/tests/admin_scripts/broken_app/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/admin_scripts/broken_app/models.py b/tests/admin_scripts/broken_app/models.py new file mode 100644 index 0000000000..f37f1efc11 --- /dev/null +++ b/tests/admin_scripts/broken_app/models.py @@ -0,0 +1 @@ +from django.db import modelz diff --git a/tests/admin_scripts/complex_app/__init__.py b/tests/admin_scripts/complex_app/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/admin_scripts/complex_app/admin/__init__.py b/tests/admin_scripts/complex_app/admin/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/admin_scripts/complex_app/admin/foo.py b/tests/admin_scripts/complex_app/admin/foo.py new file mode 100644 index 0000000000..1ed704a66b --- /dev/null +++ b/tests/admin_scripts/complex_app/admin/foo.py @@ -0,0 +1,8 @@ +from __future__ import absolute_import + +from django.contrib import admin + +from ..models.foo import Foo + + +admin.site.register(Foo) diff --git a/tests/admin_scripts/complex_app/models/__init__.py b/tests/admin_scripts/complex_app/models/__init__.py new file mode 100644 index 0000000000..7b647e74b1 --- /dev/null +++ b/tests/admin_scripts/complex_app/models/__init__.py @@ -0,0 +1,4 @@ +from .bar import Bar +from .foo import Foo + +__all__ = ['Foo', 'Bar'] diff --git a/tests/admin_scripts/complex_app/models/bar.py b/tests/admin_scripts/complex_app/models/bar.py new file mode 100644 index 0000000000..15956f7a50 --- /dev/null +++ b/tests/admin_scripts/complex_app/models/bar.py @@ -0,0 +1,11 @@ +from __future__ import absolute_import + +from django.db import models + +from ..admin import foo + + +class Bar(models.Model): + name = models.CharField(max_length=5) + class Meta: + app_label = 'complex_app' diff --git a/tests/admin_scripts/complex_app/models/foo.py b/tests/admin_scripts/complex_app/models/foo.py new file mode 100644 index 0000000000..914cf3b8b5 --- /dev/null +++ b/tests/admin_scripts/complex_app/models/foo.py @@ -0,0 +1,7 @@ +from django.db import models + + +class Foo(models.Model): + name = models.CharField(max_length=5) + class Meta: + app_label = 'complex_app' diff --git a/tests/admin_scripts/custom_templates/app_template/__init__.py b/tests/admin_scripts/custom_templates/app_template/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/admin_scripts/custom_templates/app_template/api.py b/tests/admin_scripts/custom_templates/app_template/api.py new file mode 100644 index 0000000000..439d935f73 --- /dev/null +++ b/tests/admin_scripts/custom_templates/app_template/api.py @@ -0,0 +1 @@ +# your API code \ No newline at end of file diff --git a/tests/admin_scripts/custom_templates/app_template/models.py b/tests/admin_scripts/custom_templates/app_template/models.py new file mode 100644 index 0000000000..92be216cfc --- /dev/null +++ b/tests/admin_scripts/custom_templates/app_template/models.py @@ -0,0 +1 @@ +# whatever \ No newline at end of file diff --git a/tests/admin_scripts/custom_templates/project_template.tgz b/tests/admin_scripts/custom_templates/project_template.tgz new file mode 100644 index 0000000000..2a181c9faa Binary files /dev/null and b/tests/admin_scripts/custom_templates/project_template.tgz differ diff --git a/tests/admin_scripts/custom_templates/project_template/additional_dir/Procfile b/tests/admin_scripts/custom_templates/project_template/additional_dir/Procfile new file mode 100644 index 0000000000..032f0bcd72 --- /dev/null +++ b/tests/admin_scripts/custom_templates/project_template/additional_dir/Procfile @@ -0,0 +1 @@ +# some file for {{ project_name }} test project \ No newline at end of file diff --git a/tests/admin_scripts/custom_templates/project_template/additional_dir/additional_file.py b/tests/admin_scripts/custom_templates/project_template/additional_dir/additional_file.py new file mode 100644 index 0000000000..032f0bcd72 --- /dev/null +++ b/tests/admin_scripts/custom_templates/project_template/additional_dir/additional_file.py @@ -0,0 +1 @@ +# some file for {{ project_name }} test project \ No newline at end of file diff --git a/tests/admin_scripts/custom_templates/project_template/additional_dir/extra.py b/tests/admin_scripts/custom_templates/project_template/additional_dir/extra.py new file mode 100644 index 0000000000..6b553f190f --- /dev/null +++ b/tests/admin_scripts/custom_templates/project_template/additional_dir/extra.py @@ -0,0 +1 @@ +# this file uses the {{ extra }} variable diff --git a/tests/admin_scripts/custom_templates/project_template/additional_dir/requirements.txt b/tests/admin_scripts/custom_templates/project_template/additional_dir/requirements.txt new file mode 100644 index 0000000000..032f0bcd72 --- /dev/null +++ b/tests/admin_scripts/custom_templates/project_template/additional_dir/requirements.txt @@ -0,0 +1 @@ +# some file for {{ project_name }} test project \ No newline at end of file diff --git a/tests/admin_scripts/custom_templates/project_template/manage.py b/tests/admin_scripts/custom_templates/project_template/manage.py new file mode 100755 index 0000000000..d9843c433f --- /dev/null +++ b/tests/admin_scripts/custom_templates/project_template/manage.py @@ -0,0 +1,6 @@ +# The manage.py of the {{ project_name }} test project + +# template context: +project_name = '{{ project_name }}' +project_directory = '{{ project_directory }}' +secret_key = '{{ secret_key }}' diff --git a/tests/admin_scripts/custom_templates/project_template/project_name/__init__.py b/tests/admin_scripts/custom_templates/project_template/project_name/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/admin_scripts/custom_templates/project_template/project_name/settings.py b/tests/admin_scripts/custom_templates/project_template/project_name/settings.py new file mode 100644 index 0000000000..ddc216c829 --- /dev/null +++ b/tests/admin_scripts/custom_templates/project_template/project_name/settings.py @@ -0,0 +1 @@ +# Django settings for {{ project_name }} test project. diff --git a/tests/admin_scripts/custom_templates/project_template/ticket-18091-non-ascii-template.txt b/tests/admin_scripts/custom_templates/project_template/ticket-18091-non-ascii-template.txt new file mode 100644 index 0000000000..873eaded88 --- /dev/null +++ b/tests/admin_scripts/custom_templates/project_template/ticket-18091-non-ascii-template.txt @@ -0,0 +1,2 @@ +Some non-ASCII text for testing ticket #18091: +üäö € diff --git a/tests/admin_scripts/custom_templates/project_template/ticket-19397-binary-file.ico b/tests/admin_scripts/custom_templates/project_template/ticket-19397-binary-file.ico new file mode 100644 index 0000000000..1db49645b5 Binary files /dev/null and b/tests/admin_scripts/custom_templates/project_template/ticket-19397-binary-file.ico differ diff --git a/tests/admin_scripts/management/__init__.py b/tests/admin_scripts/management/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/admin_scripts/management/commands/__init__.py b/tests/admin_scripts/management/commands/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/admin_scripts/management/commands/app_command.py b/tests/admin_scripts/management/commands/app_command.py new file mode 100644 index 0000000000..d26df12642 --- /dev/null +++ b/tests/admin_scripts/management/commands/app_command.py @@ -0,0 +1,11 @@ +from django.core.management.base import AppCommand + + +class Command(AppCommand): + help = 'Test Application-based commands' + requires_model_validation = False + args = '[appname ...]' + + def handle_app(self, app, **options): + print('EXECUTE:AppCommand app=%s, options=%s' % (app, sorted(options.items()))) + diff --git a/tests/admin_scripts/management/commands/base_command.py b/tests/admin_scripts/management/commands/base_command.py new file mode 100644 index 0000000000..2701f32a05 --- /dev/null +++ b/tests/admin_scripts/management/commands/base_command.py @@ -0,0 +1,17 @@ +from optparse import make_option + +from django.core.management.base import BaseCommand + + +class Command(BaseCommand): + option_list = BaseCommand.option_list + ( + make_option('--option_a','-a', action='store', dest='option_a', default='1'), + make_option('--option_b','-b', action='store', dest='option_b', default='2'), + make_option('--option_c','-c', action='store', dest='option_c', default='3'), + ) + help = 'Test basic commands' + requires_model_validation = False + args = '[labels ...]' + + def handle(self, *labels, **options): + print('EXECUTE:BaseCommand labels=%s, options=%s' % (labels, sorted(options.items()))) diff --git a/tests/admin_scripts/management/commands/custom_startproject.py b/tests/admin_scripts/management/commands/custom_startproject.py new file mode 100644 index 0000000000..80c6d6b805 --- /dev/null +++ b/tests/admin_scripts/management/commands/custom_startproject.py @@ -0,0 +1,11 @@ +from optparse import make_option + +from django.core.management.commands.startproject import Command as BaseCommand + + +class Command(BaseCommand): + option_list = BaseCommand.option_list + ( + make_option('--extra', + action='store', dest='extra', + help='An arbitrary extra value passed to the context'), + ) diff --git a/tests/admin_scripts/management/commands/label_command.py b/tests/admin_scripts/management/commands/label_command.py new file mode 100644 index 0000000000..3bce1305bc --- /dev/null +++ b/tests/admin_scripts/management/commands/label_command.py @@ -0,0 +1,10 @@ +from django.core.management.base import LabelCommand + + +class Command(LabelCommand): + help = "Test Label-based commands" + requires_model_validation = False + args = '