From c6e9137a04e682ef340cf443bf7c9f2f4cd0b108 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 19 2016 13:19:19 +0000 Subject: [PATCH 1/3] Add the url to the issue git repos if the issues are disabled --- diff --git a/pagure/templates/repo_info.html b/pagure/templates/repo_info.html index caec57f..74e2ddd 100644 --- a/pagure/templates/repo_info.html +++ b/pagure/templates/repo_info.html @@ -297,7 +297,8 @@ git push -u origin master {% endif %} {% if authenticated and repo_admin %} - {% if config.get('ENABLE_TICKETS', True) %} + {% if config.get('ENABLE_TICKETS', True) + and repo.settings.get('issue_tracker', True) %}
Issues GIT URLs
From 2fbe3604a57641cce9533c381bbb958708f2e136 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 19 2016 13:52:06 +0000 Subject: [PATCH 2/3] Add tests ensuring the GIT ticket URL is hidden if issues are disabled --- diff --git a/tests/test_pagure_flask_ui_issues.py b/tests/test_pagure_flask_ui_issues.py index f96c0ff..f0aaef8 100644 --- a/tests/test_pagure_flask_ui_issues.py +++ b/tests/test_pagure_flask_ui_issues.py @@ -1682,6 +1682,37 @@ class PagureFlaskIssuestests(tests.Modeltests): self.assertEqual(issue.comments[0].comment, 'Second update') + @patch('pagure.lib.git.update_git') + @patch('pagure.lib.notify.send_email') + def test_git_urls(self, p_send_email, p_ugt): + """ Check that the url to the git repo for issues is present/absent when + it should. + """ + p_send_email.return_value = True + p_ugt.return_value = True + + self.test_view_issues() + + user = tests.FakeUser() + user.username = 'pingou' + with tests.user_set(pagure.APP, user): + # Check that the git issue URL is present + output = self.app.get('/test') + self.assertNotIn( + '
Issues GIT URLs
', output.data) + + # Project w/o issue tracker + repo = pagure.lib.get_project(self.session, 'test') + repo.settings = {'issue_tracker': True} + self.session.add(repo) + self.session.commit() + + # Check that the git issue URL is gone + output = self.app.get('/test') + self.assertIn( + '
Issues GIT URLs
', output.data) + + if __name__ == '__main__': SUITE = unittest.TestLoader().loadTestsFromTestCase(PagureFlaskIssuestests) unittest.TextTestRunner(verbosity=2).run(SUITE) From b81a6468b46dc7516d3e40dae5cdd04d1e02719e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: May 22 2016 10:27:09 +0000 Subject: [PATCH 3/3] Fix indentation in the html --- diff --git a/pagure/templates/repo_info.html b/pagure/templates/repo_info.html index 74e2ddd..7ee2f46 100644 --- a/pagure/templates/repo_info.html +++ b/pagure/templates/repo_info.html @@ -278,44 +278,44 @@ git push -u origin master {% if config['DOC_APP_URL'] and repo and repo.settings.get('project_documentation', True) %} -
Docs GIT URLs
- {% if authenticated and repo_admin %} -
-
-
SSH
- -
-
- {% endif %} -
-
-
GIT
- +
Docs GIT URLs
+ {% if authenticated and repo_admin %} +
+
+
SSH
+ +
+
+ {% endif %} +
+
+
GIT
+ +
-
{% endif %} {% if authenticated and repo_admin %} - {% if config.get('ENABLE_TICKETS', True) - and repo.settings.get('issue_tracker', True) %} -
Issues GIT URLs
-
-
-
SSH
- -
-
- {% endif %} -
Pull Requests GIT URLs
-
-
-
SSH
- + {% if config.get('ENABLE_TICKETS', True) + and repo.settings.get('issue_tracker', True) %} +
Issues GIT URLs
+
+
+
SSH
+ +
+
+ {% endif %} +
Pull Requests GIT URLs
+
+
+
SSH
+ +
-
{% endif %}
@@ -326,42 +326,42 @@ git push -u origin master
{% if last_commits %} - {% endif %}