changeset 8105:9d1d00c72e61

py3: fix error in template from introducing safe_unicode in 9203621cae03 Add missing test coverage of actual edit form.
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 07 Jan 2020 12:41:33 +0100
parents 2837b66f68bb
children 0088a4b2c84e
files kallithea/templates/files/files_edit.html kallithea/tests/functional/test_files.py
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/templates/files/files_edit.html	Thu Dec 26 15:20:08 2019 +0100
+++ b/kallithea/templates/files/files_edit.html	Tue Jan 07 12:41:33 2020 +0100
@@ -59,7 +59,7 @@
                     </span>
               </div>
               <div class="panel-body no-padding">
-                <textarea id="editor" name="content" style="display:none">${h.escape(safe_unicode(c.file.content))|n}</textarea>
+                <textarea id="editor" name="content" style="display:none">${h.escape(h.safe_unicode(c.file.content))|n}</textarea>
               </div>
             </div>
             <div>
--- a/kallithea/tests/functional/test_files.py	Thu Dec 26 15:20:08 2019 +0100
+++ b/kallithea/tests/functional/test_files.py	Tue Jan 07 12:41:33 2020 +0100
@@ -480,6 +480,15 @@
         response = self.app.get(url('files_edit_home',
                                       repo_name=HG_REPO,
                                       revision='tip', f_path='vcs/nodes.py'))
+        # Odd error when on tip ...
+        self.checkSessionFlash(response, "You can only edit files with revision being a valid branch")
+        assert "Commit Message" not in response.body
+
+        # Specify branch head revision to avoid "valid branch" error and get coverage of edit form
+        response = self.app.get(url('files_edit_home',
+                                      repo_name=HG_REPO,
+                                      revision='96507bd11ecc815ebc6270fdf6db110928c09c1e', f_path='vcs/nodes.py'))
+        assert "Commit Message" in response.body
 
     def test_edit_file_view_not_on_branch_hg(self):
         self.log_user()