aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--patchwork/templates/patchwork/about.html53
-rw-r--r--patchwork/tests/test_about.py21
-rw-r--r--patchwork/views/about.py10
3 files changed, 78 insertions, 6 deletions
diff --git a/patchwork/templates/patchwork/about.html b/patchwork/templates/patchwork/about.html
index ed0c421..e087f7c 100644
--- a/patchwork/templates/patchwork/about.html
+++ b/patchwork/templates/patchwork/about.html
@@ -4,11 +4,54 @@
{% block heading %}About Patchwork{% endblock %}
{% block body %}
-<h1>About Patchwork</h1>
+<div class="container">
+ <h1>About Patchwork</h1>
-<p>Patchwork is free software, and is available from the
-<a href="http://jk.ozlabs.org/projects/patchwork/">Patchwork website</a>.</p>
+ <p>Patchwork is free software, and is available from the <a
+ href="http://jk.ozlabs.org/projects/patchwork/">Patchwork website</a>.
+ Documentation is available on <a
+ href="http://patchwork.readthedocs.io/">Read the Docs</a>.</p>
-<p>Patchwork is built on the <a href="http://djangoproject.com/">Django</a>
-web framework.</p>
+ <p>Patchwork is built on the <a href="https://djangoproject.com/">Django</a>
+ web framework using <a href="https://getbootstrap.com/">Bootstrap</a>.</p>
+
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h3 class="panel-title">Version</h3>
+ </div>
+ <ul class="list-group">
+ <li class="list-group-item">
+ <p>2.0.0-pre</p>
+ </li>
+ </ul>
+ </div>
+
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h3 class="panel-title">API Status</h3>
+ </div>
+ <ul class="list-group">
+ <li class="list-group-item">
+ REST
+ <span class="glyphicon glyphicon-question-sign" title="The REST
+ API"></span>
+ {% if enabled_apis.rest %}
+ <span class="label label-success pull-right">enabled</span>
+ {% else %}
+ <span class="label label-warning pull-right">disabled</span>
+ {% endif %}
+ </li>
+ <li class="list-group-item">
+ XML-RPC
+ <span class="glyphicon glyphicon-question-sign" title="The XML-RPC
+ API"></span>
+ {% if enabled_apis.xmlrpc %}
+ <span class="label label-success pull-right">enabled</span>
+ {% else %}
+ <span class="label label-warning pull-right">disabled</span>
+ {% endif %}
+ </li>
+ </ul>
+ </div>
+</div>
{% endblock %}
diff --git a/patchwork/tests/test_about.py b/patchwork/tests/test_about.py
index 2175641..24246ed 100644
--- a/patchwork/tests/test_about.py
+++ b/patchwork/tests/test_about.py
@@ -30,3 +30,24 @@ class AboutViewTest(TestCase):
response = self.client.get(requested_url)
self.assertRedirects(response, redirect_url, 301)
+
+ def test_xmlrpc(self):
+ with self.settings(ENABLE_XMLRPC=False):
+ response = self.client.get(reverse('about'))
+ self.assertFalse(response.context['enabled_apis']['xmlrpc'])
+
+ with self.settings(ENABLE_XMLRPC=True):
+ response = self.client.get(reverse('about'))
+ self.assertTrue(response.context['enabled_apis']['xmlrpc'])
+
+ def test_rest(self):
+ # TODO(stephenfin): There appears to be a bug in Django 1.10.x under
+ # Python 3.5, meaning we can't use 'override_settings' here or we cause
+ # the REST API tests to fail. We should investigate this.
+ with self.settings(ENABLE_REST_API=False):
+ response = self.client.get(reverse('about'))
+ self.assertFalse(response.context['enabled_apis']['rest'])
+
+ with self.settings(ENABLE_REST_API=True):
+ response = self.client.get(reverse('about'))
+ self.assertTrue(response.context['enabled_apis']['rest'])
diff --git a/patchwork/views/about.py b/patchwork/views/about.py
index 9246eaa..6d8579d 100644
--- a/patchwork/views/about.py
+++ b/patchwork/views/about.py
@@ -18,13 +18,21 @@
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponsePermanentRedirect
from django.shortcuts import render
def about(request):
- return render(request, 'patchwork/about.html')
+ context = {
+ 'enabled_apis': {
+ 'rest': settings.ENABLE_REST_API,
+ 'xmlrpc': settings.ENABLE_XMLRPC,
+ },
+ }
+
+ return render(request, 'patchwork/about.html', context)
def redirect(request):