Merge pull request #135 from mozilla/resultset-endpoint-no-jobs

Resultset endpoint no jobs
This commit is contained in:
camd 2014-04-25 09:53:27 -07:00
Родитель 3e46386d05 4cb8f64851
Коммит 662a66865b
2 изменённых файлов: 34 добавлений и 1 удалений

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

@ -180,6 +180,34 @@ def test_resultset_list_filter_by_date(webapp, initial_data,
)
def test_resultset_list_without_jobs(webapp, initial_data,
sample_resultset, jm):
"""
test retrieving a resultset list without jobs
"""
jm.store_result_set_data(sample_resultset)
resp = webapp.get(
reverse("resultset-list", kwargs={"project": jm.project}),
{"with_jobs": "false"}
)
assert resp.status_int == 200
results = resp.json['results']
assert len(results) == 10
assert all([('platforms' not in result) for result in results])
meta = resp.json['meta']
assert meta == {
u'count': len(results),
u'filter_params': {
u"with_jobs": u"false",
},
u'repository': u'test_treeherder'
}
def test_resultset_detail(webapp, eleven_jobs_processed, jm):
"""
test retrieving a resultset from the resultset-detail

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

@ -66,6 +66,7 @@ class ResultSetViewSet(viewsets.ViewSet):
count = min(int(filter.pop("count", 10)), 1000)
full = filter.pop('full', 'true').lower() == 'true'
with_jobs = filter.pop('with_jobs', 'true').lower() == 'true'
objs = jm.get_result_set_list(
offset_id,
@ -74,7 +75,11 @@ class ResultSetViewSet(viewsets.ViewSet):
filter.conditions
)
results = self.get_resultsets_with_jobs(jm, objs, full, {})
if with_jobs:
results = self.get_resultsets_with_jobs(jm, objs, full, {})
else:
results = objs
meta['count'] = len(results)
meta['repository'] = project