| |
@@ -511,6 +511,70 @@
|
| |
|
| |
@patch('pagure.lib.git.update_git')
|
| |
@patch('pagure.lib.notify.send_email')
|
| |
+ def test_view_issue_non_ascii_milestone(self, p_send_email, p_ugt):
|
| |
+ """ Test the view_issue endpoint with non-ascii milestone. """
|
| |
+ p_send_email.return_value = True
|
| |
+ p_ugt.return_value = True
|
| |
+
|
| |
+ output = self.app.get('/foo/issue/1')
|
| |
+ self.assertEqual(output.status_code, 404)
|
| |
+
|
| |
+ tests.create_projects(self.session)
|
| |
+ tests.create_projects_git(
|
| |
+ os.path.join(self.path), bare=True)
|
| |
+
|
| |
+ output = self.app.get('/test/issue/1')
|
| |
+ self.assertEqual(output.status_code, 404)
|
| |
+
|
| |
+ # Create issues to play with
|
| |
+ repo = pagure.lib.get_project(self.session, 'test')
|
| |
+ msg = pagure.lib.new_issue(
|
| |
+ session=self.session,
|
| |
+ repo=repo,
|
| |
+ title='Test issue',
|
| |
+ content='We should work on this',
|
| |
+ user='pingou',
|
| |
+ ticketfolder=None
|
| |
+ )
|
| |
+ self.session.commit()
|
| |
+ self.assertEqual(msg.title, 'Test issue')
|
| |
+
|
| |
+ # Add a non-ascii milestone to the issue but project has no milestone
|
| |
+ issue = pagure.lib.search_issues(self.session, repo, issueid=1)
|
| |
+ message = pagure.lib.edit_issue(
|
| |
+ self.session,
|
| |
+ issue=issue,
|
| |
+ milestone=b'käpy'.decode('utf-8'),
|
| |
+ private=False,
|
| |
+ user='pingou',
|
| |
+ ticketfolder=None,
|
| |
+ )
|
| |
+ self.assertEqual(message, 'Successfully edited issue #1')
|
| |
+ self.session.commit()
|
| |
+
|
| |
+ output = self.app.get('/test/issue/1')
|
| |
+ self.assertEqual(output.status_code, 200)
|
| |
+ self.assertIn(
|
| |
+ '<title>Issue #1: Test issue - test - Pagure</title>',
|
| |
+ output.data)
|
| |
+ self.assertNotIn(b'käpy'.decode('utf-8'), output.data)
|
| |
+
|
| |
+ # Add a non-ascii milestone to the project
|
| |
+ repo = pagure.lib.get_project(self.session, 'test')
|
| |
+ repo.milestones = {b'käpy'.decode('utf-8'): None}
|
| |
+ self.session.add(repo)
|
| |
+ self.session.commit()
|
| |
+
|
| |
+ # View the issue
|
| |
+ output = self.app.get('/test/issue/1')
|
| |
+ self.assertEqual(output.status_code, 200)
|
| |
+ self.assertIn(
|
| |
+ '<title>Issue #1: Test issue - test - Pagure</title>',
|
| |
+ output.data)
|
| |
+ self.assertIn(b'käpy'.decode('utf-8'), output.data.decode('utf-8'))
|
| |
+
|
| |
+ @patch('pagure.lib.git.update_git')
|
| |
+ @patch('pagure.lib.notify.send_email')
|
| |
def test_update_issue(self, p_send_email, p_ugt):
|
| |
""" Test the update_issue endpoint. """
|
| |
p_send_email.return_value = True
|
| |
Just so you know, if you don't need access to the mock object you can do