mirror of
https://github.com/django/django.git
synced 2025-08-30 07:17:49 +00:00
Fixed #30393 -- Added validation of startapp's directory option.
This commit is contained in:
parent
0f22671ecb
commit
fc9566d42d
2 changed files with 28 additions and 5 deletions
|
@ -2132,6 +2132,25 @@ class StartApp(AdminScriptTestCase):
|
|||
)
|
||||
self.assertFalse(os.path.exists(testproject_dir))
|
||||
|
||||
def test_invalid_target_name(self):
|
||||
for bad_target in ('invalid.dir_name', '7invalid_dir_name', '.invalid_dir_name'):
|
||||
with self.subTest(bad_target):
|
||||
_, err = self.run_django_admin(['startapp', 'app', bad_target])
|
||||
self.assertOutput(
|
||||
err,
|
||||
"CommandError: '%s' is not a valid app directory. Please "
|
||||
"make sure the directory is a valid identifier." % bad_target
|
||||
)
|
||||
|
||||
def test_importable_target_name(self):
|
||||
_, err = self.run_django_admin(['startapp', 'app', 'os'])
|
||||
self.assertOutput(
|
||||
err,
|
||||
"CommandError: 'os' conflicts with the name of an existing Python "
|
||||
"module and cannot be used as an app directory. Please try "
|
||||
"another directory."
|
||||
)
|
||||
|
||||
def test_overlaying_app(self):
|
||||
self.run_django_admin(['startapp', 'app1'])
|
||||
out, err = self.run_django_admin(['startapp', 'app2', 'app1'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue