From b734ecd1207547af122a7b16864b8ec0367320ae Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 17 2018 13:04:12 +0000 Subject: Only select the default template when creating a new ticket fixes https://pagure.io/pagure/issue/3330 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/new_issue.html b/pagure/templates/new_issue.html index 1e0cb0f..8429b1e 100644 --- a/pagure/templates/new_issue.html +++ b/pagure/templates/new_issue.html @@ -53,7 +53,11 @@
diff --git a/tests/test_pagure_flask_ui_issues_templates.py b/tests/test_pagure_flask_ui_issues_templates.py index 9cebff0..bf88bbd 100644 --- a/tests/test_pagure_flask_ui_issues_templates.py +++ b/tests/test_pagure_flask_ui_issues_templates.py @@ -70,7 +70,7 @@ def create_templates(repopath): 'Alice Author', 'alice@authors.tld') committer = pygit2.Signature( 'Cecil Committer', 'cecil@committers.tld') - clone_repo.create_commit( + commit = clone_repo.create_commit( 'refs/heads/master', # the name of the reference to update author, committer, @@ -81,6 +81,30 @@ def create_templates(repopath): [commit.hex] ) + # Create the default.md template + template = os.path.join(repopath, 'templates', 'default.md') + with open(template, 'w') as stream: + stream.write('Report your issue') + clone_repo.index.add(os.path.join('templates', 'default.md')) + clone_repo.index.write() + + # Commit + tree = clone_repo.index.write_tree() + author = pygit2.Signature( + 'Alice Author', 'alice@authors.tld') + committer = pygit2.Signature( + 'Cecil Committer', 'cecil@committers.tld') + clone_repo.create_commit( + 'refs/heads/master', # the name of the reference to update + author, + committer, + 'Add a default template', + # binary string representing the tree object ID + tree, + # list of binary strings representing parents of the new commit + [commit.hex] + ) + class PagureFlaskIssuestests(tests.Modeltests): """ Tests for flask issues controller of pagure """ @@ -144,10 +168,13 @@ class PagureFlaskIssuestests(tests.Modeltests): '