Bug 1427375 - Consistently use 'detail' for API error messages (#3178)

This commit is contained in:
Balaji.G 2018-01-31 02:35:02 +05:30 коммит произвёл Ed Morley
Родитель f74e37f7a9
Коммит 94a52eb286
3 изменённых файлов: 7 добавлений и 7 удалений

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

@ -295,7 +295,7 @@ def test_push_list_bad_count(webapp, test_repository):
params={'count': bad_count}, expect_errors=True)
assert resp.status_code == 400
assert resp.json == {'error': 'Valid count value required'}
assert resp.json == {'detail': 'Valid count value required'}
def test_push_author(webapp, test_repository):

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

@ -308,7 +308,7 @@ class JobsViewSet(viewsets.ViewSet):
if count > MAX_JOBS_COUNT:
msg = "Specified count exceeds API MAX_JOBS_COUNT value: {}".format(MAX_JOBS_COUNT)
return Response({"error": msg}, status=HTTP_400_BAD_REQUEST)
return Response({"detail": msg}, status=HTTP_400_BAD_REQUEST)
try:
repository = Repository.objects.get(name=project)

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

@ -100,7 +100,7 @@ class PushViewSet(viewsets.ViewSet):
float(filter_params.get(param)))
except ValueError:
return Response({
"error": "Invalid timestamp specified for {}".format(
"detail": "Invalid timestamp specified for {}".format(
param)
}, status=HTTP_400_BAD_REQUEST)
pushes = pushes.filter(**{
@ -112,7 +112,7 @@ class PushViewSet(viewsets.ViewSet):
value = int(filter_params.get(param, 0))
except ValueError:
return Response({
"error": "Invalid timestamp specified for {}".format(
"detail": "Invalid timestamp specified for {}".format(
param)
}, status=HTTP_400_BAD_REQUEST)
if value:
@ -123,7 +123,7 @@ class PushViewSet(viewsets.ViewSet):
try:
id_in_list = [int(id) for id in id_in.split(',')]
except ValueError:
return Response({"error": "Invalid id__in specification"},
return Response({"detail": "Invalid id__in specification"},
status=HTTP_400_BAD_REQUEST)
pushes = pushes.filter(id__in=id_in_list)
@ -134,12 +134,12 @@ class PushViewSet(viewsets.ViewSet):
try:
count = int(filter_params.get("count", 10))
except ValueError:
return Response({"error": "Valid count value required"},
return Response({"detail": "Valid count value required"},
status=HTTP_400_BAD_REQUEST)
if count > MAX_PUSH_COUNT:
msg = "Specified count exceeds api limit: {}".format(MAX_PUSH_COUNT)
return Response({"error": msg}, status=HTTP_400_BAD_REQUEST)
return Response({"detail": msg}, status=HTTP_400_BAD_REQUEST)
# we used to have a "full" parameter for this endpoint so you could
# specify to not fetch the revision information if it was set to