mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Refs #31516 -- Added Migration.suggest_name() tests for migrations with no operations.
This commit is contained in:
parent
a464ead29d
commit
927fead2f5
@ -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=[])]
|
||||
|
Loading…
Reference in New Issue
Block a user