1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

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

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=[])]