Refs #31516 -- Added Migration.suggest_name() tests for migrations with no operations.

This commit is contained in:
Adam Johnson 2021-03-12 11:49:18 +01:00 committed by Mariusz Felisiak
parent a464ead29d
commit 927fead2f5
1 changed files with 15 additions and 0 deletions

View File

@ -2633,6 +2633,21 @@ class AutodetectorTests(TestCase):
class MigrationSuggestNameTests(SimpleTestCase):
def test_no_operations(self):
class Migration(migrations.Migration):
operations = []
migration = Migration('some_migration', 'test_app')
self.assertIs(migration.suggest_name().startswith('auto_'), True)
def test_no_operations_initial(self):
class Migration(migrations.Migration):
initial = True
operations = []
migration = Migration('some_migration', 'test_app')
self.assertEqual(migration.suggest_name(), 'initial')
def test_single_operation(self):
class Migration(migrations.Migration):
operations = [migrations.CreateModel('Person', fields=[])]