Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
fixes bug 1102298 - Add a /contribute.json
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbe committed Dec 8, 2014
1 parent 737cd90 commit e2543b6
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
31 changes: 31 additions & 0 deletions contribute.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "MozTrap",
"description": "MozTrap test case management system",
"repository": {
"url": "https://github.com/mozilla/moztrap",
"license": "BSD",
"tests": "https://travis-ci.org/mozilla/moztrap"
},
"participate": {
"home": "https://wiki.mozilla.org/QA/MozTrap",
"docs": "http://moztrap.readthedocs.org/",
"irc": "irc://irc.mozilla.org/#moztrap",
"irc-contacts": ["camd", "peterbe", "mbrandt", "bsilverberg"]
},
"bugs": {
"list": "https://bugzilla.mozilla.org/buglist.cgi?product=Mozilla%20QA&component=MozTrap&resolution=---",
"report": "https://bugzilla.mozilla.org/enter_bug.cgi?product=Mozilla%20QA&component=MozTrap"
},
"urls": {
"prod": "https://moztrap.mozilla.org/",
"stage": "https://moztrap.allizom.org/",
"dev": "https://moztrap-dev.allizom.org/"
},
"keywords": [
"django",
"jquery",
"mysql",
"python",
"qa"
]
}
4 changes: 4 additions & 0 deletions moztrap/view/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@
# open web apps-----------------------------------------------------------
url("^owa/", include("moztrap.view.owa.urls")),

# special /contribute.json endpoint --------------------------------------
url(r"^(?P<path>contribute\.json)$", "django.views.static.serve",
{'document_root': settings.BASE_PATH})

) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
15 changes: 15 additions & 0 deletions tests/view/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Tests for home view.
"""
import json

from django.core.urlresolvers import reverse

from tests import case
Expand All @@ -26,3 +28,16 @@ def test_no_permission_redirects_to_results(self):
res = self.get(status=302)

self.assertRedirects(res, reverse("results_runs"))


class ContributeJSONViewTest(case.view.ViewTestCase):
"""Test specifically for the /contribute.json endpoint."""
@property
def url(self):
return "/contribute.json"


def test_view_contribute_json(self):
res = self.get(status=200)
self.assertEqual(res.headers["Content-Type"], "application/json")
self.assertTrue(json.loads(res.content))

0 comments on commit e2543b6

Please sign in to comment.