Fixed #17517 -- Added --name option to startproject and startapp management commands to be able to render files without a file extension. Thanks, Florian Apolloner.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17432 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2012-02-04 13:01:30 +00:00
parent bb6921ce88
commit faeee611d6
6 changed files with 42 additions and 6 deletions

View file

@ -0,0 +1 @@
# some file for {{ project_name }} test project

View file

@ -0,0 +1 @@
# some file for {{ project_name }} test project

View file

@ -1489,3 +1489,21 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
self.assertNoOutput(err)
self.assertTrue(os.path.isdir(testproject_dir))
self.assertTrue(os.path.exists(os.path.join(testproject_dir, 'run.py')))
def test_file_without_extension(self):
"Make sure the startproject management command is able to render custom files"
template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'project_template')
args = ['startproject', '--template', template_path, 'customtestproject', '-e', 'txt', '-n', 'Procfile']
testproject_dir = os.path.join(test_dir, 'customtestproject')
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, 'additional_dir')))
base_path = os.path.join(testproject_dir, 'additional_dir')
for f in ('Procfile', 'additional_file.py', 'requirements.txt'):
self.assertTrue(os.path.exists(os.path.join(base_path, f)))
with open(os.path.join(base_path, f)) as fh:
self.assertEqual(fh.read(),
'# some file for customtestproject test project')