summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMelvyn Sopacua <m.r.sopacua@gmail.com>2017-02-20 15:45:20 +0100
committerTim Graham <timograham@gmail.com>2017-07-26 13:47:35 -0400
commit5bb9b9a3881fb1a334efb2c1357a20bdce68a960 (patch)
tree3d066ba8c7f55ba66e7babcf9e2e559bfb334845 /tests
parent5ccbcc5bf61c746a1d5ec2b3d2e0dc56c1a63fe0 (diff)
Fixed #28363 -- Allowed naming the migration generated by squashmigrations.
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_commands.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
index 777081e3c7..3e4f7b5410 100644
--- a/tests/migrations/test_commands.py
+++ b/tests/migrations/test_commands.py
@@ -1356,3 +1356,25 @@ class SquashMigrationsTests(MigrationTestBase):
)
with self.assertRaisesMessage(CommandError, msg):
call_command("squashmigrations", "migrations", "0003", "0002", interactive=False, verbosity=0)
+
+ def test_squashed_name_with_start_migration_name(self):
+ """--squashed-name specifies the new migration's name."""
+ squashed_name = 'squashed_name'
+ with self.temporary_migration_module(module='migrations.test_migrations') as migration_dir:
+ call_command(
+ 'squashmigrations', 'migrations', '0001', '0002',
+ squashed_name=squashed_name, interactive=False, verbosity=0,
+ )
+ squashed_migration_file = os.path.join(migration_dir, '0001_%s.py' % squashed_name)
+ self.assertTrue(os.path.exists(squashed_migration_file))
+
+ def test_squashed_name_without_start_migration_name(self):
+ """--squashed-name also works if a start migration is omitted."""
+ squashed_name = 'squashed_name'
+ with self.temporary_migration_module(module="migrations.test_migrations") as migration_dir:
+ call_command(
+ 'squashmigrations', 'migrations', '0001',
+ squashed_name=squashed_name, interactive=False, verbosity=0,
+ )
+ squashed_migration_file = os.path.join(migration_dir, '0001_%s.py' % squashed_name)
+ self.assertTrue(os.path.exists(squashed_migration_file))