Bug 1177460 - add resultset status endpoint

This commit is contained in:
Mauro Doglio 2015-06-25 12:39:26 -07:00
Родитель c3d27c9041
Коммит 1155e674a6
2 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -314,3 +314,20 @@ def test_resultset_cancel_all(jm, resultset_with_three_jobs, pulse_action_consum
assert content['project'] == jm.project
user.delete()
def test_resultset_status(webapp, eleven_jobs_processed, jm):
"""
test retrieving the status of a resultset
"""
rs_list = jm.get_result_set_list(0, 10)
rs = rs_list[0]
resp = webapp.get(
reverse("resultset-status",
kwargs={"project": jm.project, "pk": int(rs["id"])})
)
assert resp.status_int == 200
assert isinstance(resp.json, dict)
assert resp.json == {'success': '1'}

Просмотреть файл

@ -151,3 +151,12 @@ class ResultSetViewSet(viewsets.ViewSet):
jm.disconnect()
return Response({"message": "well-formed JSON stored"})
@link()
@with_jobs
def status(self, request, project, jm, pk=None):
"""
Return a count of the jobs belonging to this resultset
grouped by job status.
"""
return Response(jm.get_resultset_status(pk))