summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSzilveszter Farkas <szilveszter.farkas@prezi.com>2014-09-12 13:11:09 -0700
committerCarl Meyer <carl@oddbird.net>2014-09-12 14:58:54 -0600
commit5e32605ce9baebf07b741c9235ea6351d565ce10 (patch)
tree943f23ba35b28a128e99c55b34405a91fe41515b /tests
parent9c8c28f6f4690814997b5a04ad29938798dd4333 (diff)
Fixed #23483 -- Prevented ImproperlyConfigured with dotted app names
Made sure the app labels stay unique for the AppConfigStubs, so migrations wouldn't fail if two dotted app names has the same last part (e.g. django.contrib.auth and vendor.auth)
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_state.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py
index ebeaffb787..db94413bac 100644
--- a/tests/migrations/test_state.py
+++ b/tests/migrations/test_state.py
@@ -254,6 +254,27 @@ class StateTests(TestCase):
with self.assertRaises(InvalidBasesError):
project_state.render()
+ def test_render_unique_app_labels(self):
+ """
+ Tests that the ProjectState render method doesn't raise an
+ ImproperlyConfigured exception about unique labels if two dotted app
+ names have the same last part.
+ """
+ class A(models.Model):
+ class Meta:
+ app_label = "django.contrib.auth"
+
+ class B(models.Model):
+ class Meta:
+ app_label = "vendor.auth"
+
+ # Make a ProjectState and render it
+ project_state = ProjectState()
+ project_state.add_model_state(ModelState.from_model(A))
+ project_state.add_model_state(ModelState.from_model(B))
+ final_apps = project_state.render()
+ self.assertEqual(len(final_apps.get_models()), 2)
+
def test_equality(self):
"""
Tests that == and != are implemented correctly.