diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2011-12-29 19:06:57 +0000 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2011-12-29 19:06:57 +0000 |
| commit | a82204fa9a5c9262252cb038628ce49477e0f7cf (patch) | |
| tree | 0240ca3d7a7f73cb02f642c1d48d8d59e45126f2 /tests/regressiontests/admin_scripts/tests.py | |
| parent | f185024fc40d38fb4bcb9d3bb4a9b7a9e0f94219 (diff) | |
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
Diffstat (limited to 'tests/regressiontests/admin_scripts/tests.py')
| -rw-r--r-- | tests/regressiontests/admin_scripts/tests.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/regressiontests/admin_scripts/tests.py b/tests/regressiontests/admin_scripts/tests.py index d33cfee83b..8d820f6dca 100644 --- a/tests/regressiontests/admin_scripts/tests.py +++ b/tests/regressiontests/admin_scripts/tests.py @@ -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'] |
