mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Moved validation of project names to an earlier spot so no directory with invalid name is created.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17288 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f185024fc4
commit
a82204fa9a
2 changed files with 25 additions and 11 deletions
|
@ -1386,6 +1386,20 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
|
|||
self.assertNoOutput(out)
|
||||
self.assertOutput(err, "File exists")
|
||||
|
||||
def test_invalid_project_name(self):
|
||||
def cleanup(p):
|
||||
if os.path.exists(p):
|
||||
shutil.rmtree(p)
|
||||
|
||||
"Make sure the startproject management command validates a project name"
|
||||
args = ['startproject', '7testproject']
|
||||
testproject_dir = os.path.join(test_dir, '7testproject')
|
||||
|
||||
out, err = self.run_django_admin(args)
|
||||
self.addCleanup(cleanup, testproject_dir)
|
||||
self.assertOutput(err, "Error: '7testproject' is not a valid project name. Please make sure the name begins with a letter or underscore.")
|
||||
self.assertFalse(os.path.exists(testproject_dir))
|
||||
|
||||
def test_simple_project_different_directory(self):
|
||||
"Make sure the startproject management command creates a project in a specific directory"
|
||||
args = ['startproject', 'testproject', 'othertestproject']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue