[damned-lies] Fixed logic in displaying bug report URLs



commit 5c9e77340b26744299e00c86fd976fc05b8e6557
Author: Claude Paroz <claude 2xlibre net>
Date:   Thu Apr 27 18:00:05 2017 +0200

    Fixed logic in displaying bug report URLs

 stats/tests/tests.py         |   17 +++++++++++++++++
 templates/module_detail.html |   13 ++++++-------
 2 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/stats/tests/tests.py b/stats/tests/tests.py
index 88beaab..3c395f2 100644
--- a/stats/tests/tests.py
+++ b/stats/tests/tests.py
@@ -70,6 +70,23 @@ class ModuleTestCase(TestCase):
         response = self.client.get(reverse('module_branch', args=['gnome-hello', 'missing']))
         self.assertEqual(response.status_code, 404)
 
+    def test_module_bugs_reporting(self):
+        response = self.client.get(reverse('module', args=[self.mod.name]))
+        self.assertContains(
+            response,
+            'https://bugzilla.gnome.org/buglist.cgi?product=test&amp;keywords_type=anywords'
+            '&amp;keywords=I18N+L10N&amp;bug_status=UNCONFIRMED&amp;bug_status=NEW&amp;bug_status=ASSIGNED'
+            '&amp;bug_status=REOPENED&amp;bug_status=NEEDINFO'
+        )
+        self.assertContains(
+            response,
+            'https://bugzilla.gnome.org/enter_bug.cgi?product=test&amp;keywords=I18N+L10N&amp;component=test'
+        )
+        self.mod.bugs_base = None
+        self.mod.save()
+        response = self.client.get(reverse('module', args=[self.mod.name]))
+        self.assertContains(response, "Sorry, no known locations to report bugs for this module.")
+
     def test_branch_methods(self):
         self.assertTrue(self.branch.is_head())
         self.assertEqual(self.branch.get_vcs_url(), "git://git.gnome.org/gnome-hello")
diff --git a/templates/module_detail.html b/templates/module_detail.html
index 2c95530..9268227 100644
--- a/templates/module_detail.html
+++ b/templates/module_detail.html
@@ -65,18 +65,17 @@ $(document).ready(function() {
 </div>
 
 <div class="col-md-5 col-sm-5">
-    {% if module.bugs_base %}
     <h2>{% trans "Bug reporting" %}</h2>
     <ul>
-        {% if module.get_bugs_i18n_url %}
-        <li><a href="{{ module.get_bugs_i18n_url }}">{% trans "Show existing i18n and l10n bugs" %}</a></li>
-        {% elif module.get_bugs_enter_url %}
-        <li><a href="{{ module.get_bugs_enter_url }}">{% trans "Report a bug" %}</a></li>
-        {% else %}
+        {% if not module.bugs_base %}
         <li><em>{% trans "Sorry, no known locations to report bugs for this module." %}</em></li>
+        {% else %}
+            {% if module.get_bugs_i18n_url %}
+            <li><a href="{{ module.get_bugs_i18n_url }}">{% trans "Show existing i18n and l10n bugs" 
%}</a></li>
+            {% endif %}
+            <li><a href="{{ module.get_bugs_enter_url }}">{% trans "Report a bug" %}</a></li>
         {% endif %}
     </ul>
-    {% endif %}
 </div>
 
 <div class="clearfix"></div>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]