summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPrabakaran Kumaresshan <k_prabakaran@hotmail.com>2018-10-19 12:26:33 +0530
committerTim Graham <timograham@gmail.com>2018-10-23 10:05:24 -0400
commit10d82c85aa5f8bd6adff0db49798dd368455cdcf (patch)
tree76e2494c9d348e3ad5dac5fe5d40c15bc47986bb /tests
parent136a900ef98a7b7261a124308c8c26370ff2d5e4 (diff)
Fixed #29831 -- Added validation for makemigrations --name.
Diffstat (limited to 'tests')
-rw-r--r--tests/migrations/test_commands.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
index 33b85578af..816abea65a 100644
--- a/tests/migrations/test_commands.py
+++ b/tests/migrations/test_commands.py
@@ -1352,6 +1352,11 @@ class MakeMigrationsTests(MigrationTestBase):
self.assertIn("dependencies=[\n('migrations','0001_%s'),\n]" % migration_name_0001, content)
self.assertIn("operations=[\n]", content)
+ def test_makemigrations_with_invalid_custom_name(self):
+ msg = 'The migration name must be a valid Python identifier.'
+ with self.assertRaisesMessage(CommandError, msg):
+ call_command('makemigrations', 'migrations', '--name', 'invalid name', '--empty')
+
def test_makemigrations_check(self):
"""
makemigrations --check should exit with a non-zero status when