From 8031708ee35ef5f2e8de9936b8c9ad8b04f0946c Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 25 2019 16:16:38 +0000 Subject: Fix and add a dedicated test creating a PR with files having non-ascii names This ensure we can always create and display a PR when one or more of the files in it has non-ascii characters. Fixes https://pagure.io/pagure/issue/3391 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/repo_pull_request.html b/pagure/templates/repo_pull_request.html index b2ff517..8f544aa 100644 --- a/pagure/templates/repo_pull_request.html +++ b/pagure/templates/repo_pull_request.html @@ -683,7 +683,7 @@
file added
- {{filepath}} + {{ filepath | unicode }}
{%- endmacro %} diff --git a/tests/test_pagure_flask_ui_fork.py b/tests/test_pagure_flask_ui_fork.py index bc5a12a..e06da68 100644 --- a/tests/test_pagure_flask_ui_fork.py +++ b/tests/test_pagure_flask_ui_fork.py @@ -2388,6 +2388,192 @@ More information self.assertNotIn('
Create new Pull Request for master - fork/pingou/test\n - ' + 'Pagure', output_text) + self.assertIn( + '\n', + output_text) + # Check that we prefilled the input fields as expected: + self.assertIn( + '', output_text) + self.assertIn( + ' master', + output_text) + + csrf_token = self.get_csrf(output=output) + + # Case 1 - Add an initial comment + data = { + 'csrf_token': csrf_token, + 'title': 'foo bar PR', + 'initial_comment': 'Test Initial Comment', + } + + output = self.app.post( + '/fork/pingou/test/diff/master..feature_foo', + data=data, follow_redirects=True) + self.assertEqual(output.status_code, 200) + output_text = output.get_data(as_text=True) + self.assertIn( + 'PR#2: foo bar PR - test\n - Pagure', + output_text) + self.assertIn('

Test Initial Comment

', + output_text) + self.assertEqual( + output_text.count('title="PY C (pingou)"'), + 2) + + @patch('pagure.lib.notify.send_email') def test_new_request_pull_req_sign_off_view(self, send_email): """ Test the new_request_pull endpoint. """ send_email.return_value = True