Browse files

remove `/v1/totals` REST endpoint - there's currently no need for mkt…

… for it
  • Loading branch information...
1 parent 75eb368 commit c7c22f8317336fc5e42014cac8c8c0ffbb5a787a @hannosch hannosch committed Feb 22, 2013
Showing with 0 additions and 44 deletions.
  1. +0 −28 monolith/tests/tests_views.py
  2. +0 −16 monolith/views.py
View
28 monolith/tests/tests_views.py
@@ -73,31 +73,3 @@ def test_query_time_invalid_json(self):
res = self.app.post('/v1/time', '{"que"""', expect_errors=True)
self.assertEqual(res.status_code, 400)
self.assertEqual(res.json['status'], 'error')
-
- def test_get_totals(self):
- mock_get = mock.Mock()
- mock_get.return_value = {
- '_type': 'apps', 'exists': True, '_index': 'totals',
- '_source': {'downloads': 1, 'users': 2},
- '_version': 1, '_id': '1',
- }
- with mock.patch('pyelasticsearch.client.ElasticSearch.get', mock_get):
- res = self.app.get('/v1/totals/apps/1')
- self.assertTrue('_source' in res.json)
- self.assertEqual(res.json['_source'], {'downloads': 1, 'users': 2})
-
- def test_get_totals_not_found(self):
- mock_get = mock.Mock()
- data = {
- '_type': 'apps', '_id': '2', 'exists': False, '_index': 'totals',
- }
-
- def fail(*args):
- from pyelasticsearch import ElasticHttpNotFoundError
- raise ElasticHttpNotFoundError(404, data)
-
- mock_get.side_effect = fail
- with mock.patch('pyelasticsearch.client.ElasticSearch.get', mock_get):
- res = self.app.get('/v1/totals/apps/2', expect_errors=True)
- self.assertEqual(res.status_code, 404)
- self.assertEqual(res.json, data)
View
16 monolith/views.py
@@ -32,12 +32,6 @@ def get_info(request):
cors_policy={'origins': ('*',), 'credentials': True})
-es_totals = Service(
- name='elasticsearch-totals',
- path='/v1/totals/{doc_type}/{_id}',
- description="Raw access to ES lifetime total data.")
-
-
def valid_json_body(request):
# XXX put this back in cornice.validators
try:
@@ -53,13 +47,3 @@ def query_es_time(request):
except ElasticHttpError as e:
request.response.status = e.status_code
return e.error
-
-
-@es_totals.get(renderer='json')
-def get_es_totals(request):
- match = request.matchdict
- try:
- return request.es.get('totals', match['doc_type'], match['_id'])
- except ElasticHttpError as e:
- request.response.status = e.status_code
- return e.error

0 comments on commit c7c22f8

Please sign in to comment.