summaryrefslogtreecommitdiff
path: root/tests/regressiontests/admin_scripts
diff options
context:
space:
mode:
authorFlorian Apolloner <florian@apolloner.eu>2012-08-28 23:22:06 +0200
committerFlorian Apolloner <florian@apolloner.eu>2012-08-28 23:23:07 +0200
commit3afb5916b215c79e36408b729c9516bc435f5cb7 (patch)
tree849c01aae1ef5fbe2396ee6960ba29ad764b8c6a /tests/regressiontests/admin_scripts
parent20012b961ea5306e1a381a3a2880627dd5af0d15 (diff)
Fixed #18091 -- Non-ASCII templates break `django-admin.py startproject --template=TEMPLATE`.
Thanks to Claude Huchet and Tomáš Ehrlich for the patch.
Diffstat (limited to 'tests/regressiontests/admin_scripts')
-rw-r--r--tests/regressiontests/admin_scripts/custom_templates/project_template/ticket-18091-non-ascii-template.txt2
-rw-r--r--tests/regressiontests/admin_scripts/tests.py13
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/regressiontests/admin_scripts/custom_templates/project_template/ticket-18091-non-ascii-template.txt b/tests/regressiontests/admin_scripts/custom_templates/project_template/ticket-18091-non-ascii-template.txt
new file mode 100644
index 0000000000..873eaded88
--- /dev/null
+++ b/tests/regressiontests/admin_scripts/custom_templates/project_template/ticket-18091-non-ascii-template.txt
@@ -0,0 +1,2 @@
+Some non-ASCII text for testing ticket #18091:
+üäö €
diff --git a/tests/regressiontests/admin_scripts/tests.py b/tests/regressiontests/admin_scripts/tests.py
index a8fc7ed503..3af291b806 100644
--- a/tests/regressiontests/admin_scripts/tests.py
+++ b/tests/regressiontests/admin_scripts/tests.py
@@ -1573,3 +1573,16 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase):
self.assertOutput(err, "Destination directory '%s' does not exist, please create it first." % testproject_dir)
self.assertFalse(os.path.exists(testproject_dir))
+
+ def test_custom_project_template_with_non_ascii_templates(self):
+ "Ticket 18091: Make sure the startproject management command is able to render templates with non-ASCII content"
+ template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'project_template')
+ args = ['startproject', '--template', template_path, '--extension=txt', 'customtestproject']
+ 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.assertEqual(open(os.path.join(testproject_dir, 'ticket-18091-non-ascii-template.txt')).read(),
+ 'Some non-ASCII text for testing ticket #18091:\n\xc3\xbc\xc3\xa4\xc3\xb6 \xe2\x82\xac\n')