summaryrefslogtreecommitdiff
path: root/tests/regressiontests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2012-12-20 16:10:19 +0800
committerRussell Keith-Magee <russell@keith-magee.com>2012-12-20 16:14:10 +0800
commitb7607003a543b11c62ad4d2ca1f8e12bd4b97b89 (patch)
treedd870bfe8868969a24ef9ed2d18182968e69453c /tests/regressiontests
parent9892919b0df0e7369ab793119342182cf91d549d (diff)
[1.5.x] Fixed #19401 -- Ensure that swappable model references are case insensitive.
This is necessary because get_model() checks are case insensitive, and if the swapable check isn't, the swappable logic gets tied up in knots with models that are partially swapped out. Thanks to chris@cogdon.org for the report and extensive analysis, and Preston for his work on the draft patch. Backport of c04c03d from trunk.
Diffstat (limited to 'tests/regressiontests')
-rw-r--r--tests/regressiontests/swappable_models/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/swappable_models/tests.py b/tests/regressiontests/swappable_models/tests.py
index 75644e32aa..089b391416 100644
--- a/tests/regressiontests/swappable_models/tests.py
+++ b/tests/regressiontests/swappable_models/tests.py
@@ -9,6 +9,8 @@ from django.db.models.loading import cache
from django.test import TestCase
from django.test.utils import override_settings
+from regressiontests.swappable_models.models import Article
+
class SwappableModelTests(TestCase):
def setUp(self):
@@ -44,3 +46,13 @@ class SwappableModelTests(TestCase):
for ct in ContentType.objects.all()]
self.assertIn(('swappable_models', 'alternatearticle'), apps_models)
self.assertNotIn(('swappable_models', 'article'), apps_models)
+
+ @override_settings(TEST_ARTICLE_MODEL='swappable_models.article')
+ def test_case_insensitive(self):
+ "Model names are case insensitive. Check that model swapping honors this."
+ try:
+ Article.objects.all()
+ except AttributeError:
+ self.fail('Swappable model names should be case insensitive.')
+
+ self.assertIsNone(Article._meta.swapped)