From bc63ba700a0ae3ba435c267789d8c2e3931016df Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 4 Jan 2012 23:55:34 +0000 Subject: Fixed #17503 -- A destination directory passed to startproject or startapp as optional second argument is now reused as the project/app directory, rather than a new project/app directory created within it. Refs #17042. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17340 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/admin_scripts/tests.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'tests/regressiontests/admin_scripts/tests.py') diff --git a/tests/regressiontests/admin_scripts/tests.py b/tests/regressiontests/admin_scripts/tests.py index f896817eab..948eb3a659 100644 --- a/tests/regressiontests/admin_scripts/tests.py +++ b/tests/regressiontests/admin_scripts/tests.py @@ -1404,17 +1404,17 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase): "Make sure the startproject management command creates a project in a specific directory" args = ['startproject', 'testproject', 'othertestproject'] testproject_dir = os.path.join(test_dir, 'othertestproject') + os.mkdir(testproject_dir) out, err = self.run_django_admin(args) self.addCleanup(shutil.rmtree, testproject_dir) self.assertNoOutput(err) - self.assertTrue(os.path.isdir(os.path.join(testproject_dir, 'testproject'))) - self.assertTrue(os.path.exists(os.path.join(testproject_dir, 'testproject', 'manage.py'))) + self.assertTrue(os.path.exists(os.path.join(testproject_dir, 'manage.py'))) # running again.. out, err = self.run_django_admin(args) self.assertNoOutput(out) - self.assertOutput(err, "File exists") + self.assertOutput(err, "already exists") def test_custom_project_template(self): "Make sure the startproject management command is able to use a different project template" @@ -1452,6 +1452,19 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase): self.assertTrue(os.path.isdir(testproject_dir)) self.assertTrue(os.path.exists(os.path.join(testproject_dir, 'run.py'))) + def test_custom_project_template_from_tarball_to_alternative_location(self): + "Startproject can use a project template from a tarball and create it in a specified location" + template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'project_template.tgz') + args = ['startproject', '--template', template_path, 'tarballtestproject', 'altlocation'] + testproject_dir = os.path.join(test_dir, 'altlocation') + os.mkdir(testproject_dir) + + out, err = self.run_django_admin(args) + self.addCleanup(shutil.rmtree, testproject_dir) + self.assertNoOutput(err) + self.assertTrue(os.path.isdir(testproject_dir)) + self.assertTrue(os.path.exists(os.path.join(testproject_dir, 'run.py'))) + def test_custom_project_template_from_tarball_by_url(self): "Make sure the startproject management command is able to use a different project template from a tarball via a url" template_url = '%s/admin_scripts/custom_templates/project_template.tgz' % self.live_server_url -- cgit v1.3