Add version endpoint
This commit is contained in:
Родитель
c899910a84
Коммит
b2f658cae5
|
@ -424,3 +424,11 @@ class TestAtomicRequests(WithDynamicEndpoints, TransactionTestCase):
|
|||
assert qs.count() == 0
|
||||
finally:
|
||||
qs.all().delete()
|
||||
|
||||
|
||||
class TestVersion(TestCase):
|
||||
|
||||
def test_version_json(self):
|
||||
res = self.client.get('/__version__')
|
||||
eq_(res.status_code, 200)
|
||||
eq_(res._headers['content-type'], ('Content-Type', 'application/json'))
|
||||
|
|
|
@ -22,6 +22,7 @@ urlpatterns = patterns(
|
|||
url('^contribute.json$', views.contribute, name='contribute.json'),
|
||||
url(r'^wafflejs$', wafflejs, name='wafflejs'),
|
||||
('^services/', include(services_patterns)),
|
||||
url('^__version__$', views.version, name='version.json'),
|
||||
|
||||
url('^opensearch.xml$', 'olympia.api.views.render_xml',
|
||||
{'template': 'amo/opensearch.xml'},
|
||||
|
|
|
@ -160,6 +160,12 @@ def cspreport(request):
|
|||
return HttpResponse()
|
||||
|
||||
|
||||
@non_atomic_requests
|
||||
def version(request):
|
||||
path = os.path.join(settings.ROOT, 'version.json')
|
||||
return HttpResponse(open(path, 'rb'), content_type='application/json')
|
||||
|
||||
|
||||
@non_atomic_requests
|
||||
def plugin_check_redirect(request):
|
||||
return http.HttpResponseRedirect('%s?%s' % (
|
||||
|
|
|
@ -231,13 +231,14 @@ SUPPORTED_NONAPPS = (
|
|||
'developer_agreement', 'developer_faq', 'developers', 'editors', 'faq',
|
||||
'jsi18n', 'localizers', 'review_guide', 'google1f3e37b7351799a5.html',
|
||||
'robots.txt', 'statistics', 'services', 'sunbird', 'static', 'user-media',
|
||||
'__version__',
|
||||
)
|
||||
DEFAULT_APP = 'firefox'
|
||||
|
||||
# paths that don't require a locale prefix
|
||||
SUPPORTED_NONLOCALES = (
|
||||
'contribute.json', 'google1f3e37b7351799a5.html', 'robots.txt', 'services',
|
||||
'downloads', 'blocklist', 'static', 'user-media',
|
||||
'downloads', 'blocklist', 'static', 'user-media', '__version__',
|
||||
)
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"source": "https://github.com/mozilla/olympia",
|
||||
"version": "origin/master",
|
||||
"commit": "0000000"
|
||||
}
|
Загрузка…
Ссылка в новой задаче