1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #26521 -- Adjusted CreateModel bases validation to account for mixins.

Thanks Collin for the report.
This commit is contained in:
Simon Charette
2016-04-28 18:20:48 -04:00
parent ce32c3e2cc
commit f951bb78cb
2 changed files with 23 additions and 6 deletions

View File

@@ -19,6 +19,10 @@ except ImportError:
sqlparse = None
class Mixin(object):
pass
class OperationTestBase(MigrationTestBase):
"""
Common functions to help test operations.
@@ -244,6 +248,20 @@ class OperationTests(OperationTestBase):
fields=[],
bases=(UnicodeModel, 'migrations.UnicodeModel',),
)
message = "Found duplicate value <class 'django.db.models.base.Model'> in CreateModel bases argument."
with self.assertRaisesMessage(ValueError, message):
migrations.CreateModel(
"Pony",
fields=[],
bases=(models.Model, models.Model,),
)
message = "Found duplicate value <class 'migrations.test_operations.Mixin'> in CreateModel bases argument."
with self.assertRaisesMessage(ValueError, message):
migrations.CreateModel(
"Pony",
fields=[],
bases=(Mixin, Mixin,),
)
def test_create_model_with_duplicate_manager_name(self):
with self.assertRaisesMessage(ValueError, 'Found duplicate value objects in CreateModel managers argument.'):