summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-02-16 15:54:00 -0500
committerTim Graham <timograham@gmail.com>2015-02-16 18:06:13 -0500
commitad2c6a756b8c47834bcebf91552475050f9cefc4 (patch)
tree25697d413ed8e2f1d383d14a9d1ad1b9024794ee
parentfb9551189da7d0462633b7f2520daa95f80b2a09 (diff)
[1.8.x] Moved contrib.contenttypes tests out of contrib.
Backport of 664c038f2c5b56d1ce929243d29cd4e11ea5f9ea from master
-rw-r--r--django/contrib/contenttypes/tests/__init__.py0
-rw-r--r--django/contrib/contenttypes/tests/models.py43
-rw-r--r--tests/contenttypes_tests/models.py41
-rw-r--r--tests/contenttypes_tests/test_models.py (renamed from django/contrib/contenttypes/tests/tests.py)0
-rwxr-xr-xtests/runtests.py2
5 files changed, 42 insertions, 44 deletions
diff --git a/django/contrib/contenttypes/tests/__init__.py b/django/contrib/contenttypes/tests/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
--- a/django/contrib/contenttypes/tests/__init__.py
+++ /dev/null
diff --git a/django/contrib/contenttypes/tests/models.py b/django/contrib/contenttypes/tests/models.py
deleted file mode 100644
index a173f091bd..0000000000
--- a/django/contrib/contenttypes/tests/models.py
+++ /dev/null
@@ -1,43 +0,0 @@
-from django.db import models
-from django.utils.encoding import python_2_unicode_compatible
-from django.utils.http import urlquote
-
-
-class ConcreteModel(models.Model):
- name = models.CharField(max_length=10)
-
-
-class ProxyModel(ConcreteModel):
- class Meta:
- proxy = True
-
-
-@python_2_unicode_compatible
-class FooWithoutUrl(models.Model):
- """
- Fake model not defining ``get_absolute_url`` for
- ContentTypesTests.test_shortcut_view_without_get_absolute_url()
- """
- name = models.CharField(max_length=30, unique=True)
-
- def __str__(self):
- return self.name
-
-
-class FooWithUrl(FooWithoutUrl):
- """
- Fake model defining ``get_absolute_url`` for
- ContentTypesTests.test_shortcut_view().
- """
-
- def get_absolute_url(self):
- return "/users/%s/" % urlquote(self.name)
-
-
-class FooWithBrokenAbsoluteUrl(FooWithoutUrl):
- """
- Fake model defining a ``get_absolute_url`` method containing an error
- """
-
- def get_absolute_url(self):
- return "/users/%s/" % self.unknown_field
diff --git a/tests/contenttypes_tests/models.py b/tests/contenttypes_tests/models.py
index dadc40d3d9..15148cdebd 100644
--- a/tests/contenttypes_tests/models.py
+++ b/tests/contenttypes_tests/models.py
@@ -2,6 +2,7 @@ from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
+from django.utils.http import urlquote
@python_2_unicode_compatible
@@ -35,3 +36,43 @@ class SchemeIncludedURL(models.Model):
def get_absolute_url(self):
return self.url
+
+
+class ConcreteModel(models.Model):
+ name = models.CharField(max_length=10)
+
+
+class ProxyModel(ConcreteModel):
+ class Meta:
+ proxy = True
+
+
+@python_2_unicode_compatible
+class FooWithoutUrl(models.Model):
+ """
+ Fake model not defining ``get_absolute_url`` for
+ ContentTypesTests.test_shortcut_view_without_get_absolute_url()
+ """
+ name = models.CharField(max_length=30, unique=True)
+
+ def __str__(self):
+ return self.name
+
+
+class FooWithUrl(FooWithoutUrl):
+ """
+ Fake model defining ``get_absolute_url`` for
+ ContentTypesTests.test_shortcut_view().
+ """
+
+ def get_absolute_url(self):
+ return "/users/%s/" % urlquote(self.name)
+
+
+class FooWithBrokenAbsoluteUrl(FooWithoutUrl):
+ """
+ Fake model defining a ``get_absolute_url`` method containing an error
+ """
+
+ def get_absolute_url(self):
+ return "/users/%s/" % self.unknown_field
diff --git a/django/contrib/contenttypes/tests/tests.py b/tests/contenttypes_tests/test_models.py
index eb436b6a64..eb436b6a64 100644
--- a/django/contrib/contenttypes/tests/tests.py
+++ b/tests/contenttypes_tests/test_models.py
diff --git a/tests/runtests.py b/tests/runtests.py
index c196067530..9e308fe572 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -146,7 +146,7 @@ def setup(verbosity, test_labels):
# these 'tests.migrations' modules don't actually exist, but this lets
# us skip creating migrations for the test models.
'auth': 'django.contrib.auth.tests.migrations',
- 'contenttypes': 'django.contrib.contenttypes.tests.migrations',
+ 'contenttypes': 'contenttypes_tests.migrations',
}
if verbosity > 0: