Refs #31703 -- Added Migration.suggest_name() test for initial migration with multiple CreateModels.

This commit is contained in:
Jon Dufresne 2020-06-13 10:06:05 -07:00 committed by Mariusz Felisiak
parent bce180dd05
commit 01195c4a83
1 changed files with 11 additions and 0 deletions

View File

@ -2505,6 +2505,17 @@ class MigrationSuggestNameTests(SimpleTestCase):
migration = Migration('0001_initial', 'test_app')
self.assertEqual(migration.suggest_name(), 'animal_person')
def test_two_create_models_with_initial_true(self):
class Migration(migrations.Migration):
initial = True
operations = [
migrations.CreateModel('Person', fields=[]),
migrations.CreateModel('Animal', fields=[]),
]
migration = Migration('0001_initial', 'test_app')
self.assertEqual(migration.suggest_name(), 'animal_person')
def test_none_name(self):
class Migration(migrations.Migration):
operations = [migrations.RunSQL('SELECT 1 FROM person;')]