mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user