diff options
| author | Marc Tamlyn <marc.tamlyn@gmail.com> | 2012-07-16 23:26:31 +0100 |
|---|---|---|
| committer | Florian Apolloner <florian@apolloner.eu> | 2012-07-25 22:24:41 +0200 |
| commit | a875f612e0ae84c2084d0b6230ffafe32a9777c8 (patch) | |
| tree | 9ad0cdb701c91396ac4dbcdcfe501418e8c151fc /tests/regressiontests/admin_scripts/tests.py | |
| parent | 59d99772f0e3c69bc1824ce1e76438d89c50c9b9 (diff) | |
Fixed #18634 -- Don't escape variables in the context for startproject/startapp.
The & symbols which can come up in the secret key were
being escaped to &.
Diffstat (limited to 'tests/regressiontests/admin_scripts/tests.py')
| -rw-r--r-- | tests/regressiontests/admin_scripts/tests.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/regressiontests/admin_scripts/tests.py b/tests/regressiontests/admin_scripts/tests.py index ecb16df53a..546fa7d79c 100644 --- a/tests/regressiontests/admin_scripts/tests.py +++ b/tests/regressiontests/admin_scripts/tests.py @@ -1541,6 +1541,24 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase): self.assertIn("project_name = 'another_project'", content) self.assertIn("project_directory = '%s'" % testproject_dir, content) + def test_no_escaping_of_project_variables(self): + "Make sure template context variables are not html escaped" + # We're using a custom command so we need the alternate settings + self.write_settings('alternate_settings.py') + template_path = os.path.join(test_dir, 'admin_scripts', 'custom_templates', 'project_template') + args = ['custom_startproject', '--template', template_path, 'another_project', 'project_dir', '--extra', '<&>', '--settings=alternate_settings'] + testproject_dir = os.path.join(test_dir, 'project_dir') + os.mkdir(testproject_dir) + out, err = self.run_manage(args) + self.addCleanup(shutil.rmtree, testproject_dir) + self.assertNoOutput(err) + test_manage_py = os.path.join(testproject_dir, 'additional_dir', 'extra.py') + with open(test_manage_py, 'r') as fp: + content = fp.read() + self.assertIn("<&>", content) + # tidy up alternate settings + self.remove_settings('alternate_settings.py') + def test_custom_project_destination_missing(self): """ Make sure an exception is raised when the provided |
