From f6e82be89fb684b5429d65f2bdb1b04c0ff0cd8d Mon Sep 17 00:00:00 2001 From: Clement Verna Date: Feb 24 2016 15:39:36 +0000 Subject: Modified if statement and added split() to exclude whitespace only comments. Added Initial comment to unit tests Fixes issue #571 --- diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index 0a2d3fb..f730650 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -946,7 +946,7 @@ def new_request_pull(repo, branch_to, branch_from, username=None): requestfolder=APP.config['REQUESTS_FOLDER'], ) - if not form.initial_comment.data == '': + if form.initial_comment.data.strip() != '': pagure.lib.add_pull_request_comment( SESSION, request=request, @@ -1113,7 +1113,7 @@ def new_remote_request_pull(repo, username=None): requestfolder=APP.config['REQUESTS_FOLDER'], ) - if not form.initial_comment.data == '': + if form.initial_comment.data.strip() != '': pagure.lib.add_pull_request_comment( SESSION, request=request, diff --git a/tests/test_pagure_flask_ui_fork.py b/tests/test_pagure_flask_ui_fork.py index 55c88d4..822cbae 100644 --- a/tests/test_pagure_flask_ui_fork.py +++ b/tests/test_pagure_flask_ui_fork.py @@ -1404,6 +1404,7 @@ index 0000000..2a552bb data = { 'csrf_token': csrf_token, 'title': 'foo bar PR', + 'initial_comment': 'Test Initial Comment', } output = self.app.post( @@ -1412,6 +1413,7 @@ index 0000000..2a552bb self.assertIn( 'PR#2: foo bar PR - test\n - Pagure', output.data) + self.assertIn('

Test Initial Comment

', output.data) @patch('pagure.lib.notify.send_email') def test_new_request_pull_empty_repo(self, send_email):