Optionally serve test run details in full when no test name is provided.

This commit is contained in:
Tim Buckley 2015-07-29 14:10:50 -06:00
parent c2669a07be
commit b3bdeabaf3
2 changed files with 12 additions and 7 deletions

View File

@ -81,10 +81,14 @@ def _load_details(run_id, test_name):
raise RunNotFoundException("Requested test run could not be found")
details_map = _cached_details[run_id]
if test_name in details_map:
return details_map[test_name]
if test_name is None:
return details_map
else:
raise TestNotFoundException("Requested test could not be found in run")
if test_name in details_map:
return details_map[test_name]
else:
raise TestNotFoundException(
"Requested test could not be found in run")
class TempestRunRawEndpoint(Endpoint):
@ -98,6 +102,6 @@ class TempestRunTreeEndpoint(Endpoint):
class TempestRunDetailsEndpoint(Endpoint):
def get(self, request, run_id, test_name):
def get(self, request, run_id, test_name=None):
return _load_details(run_id, test_name)

View File

@ -28,9 +28,10 @@ urlpatterns = patterns('',
url(r'^api_raw_(?P<run_id>\d+).json$',
TempestRunRawEndpoint.as_view(),
name='tempest_api_raw'),
url(r'^api_details_(\d+)_([^/]+).json$',
TempestRunDetailsEndpoint.as_view(),
name='tempest_api_details'),
url(r'^api_details_(?P<run_id>\d+).json$',
TempestRunDetailsEndpoint.as_view()),
url(r'^api_details_(?P<run_id>\d+)_(?P<test_name>[^/]+).json$',
TempestRunDetailsEndpoint.as_view()),
url(r'^aggregate.html$',
AggregateResultsView.as_view(),