Skip to content

Commit

Permalink
return json.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyqin committed Oct 25, 2017
1 parent 13e5a20 commit c06d1c1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions testcube/core/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def handler(self, request, pk=None):

instance = self.get_object()
assert isinstance(instance, ResetResult)
required_fields = ['outcome', 'stdout', 'duration', 'run_on', 'test_client']
required_fields = ['outcome', 'duration', 'run_on', 'test_client']
optional_field = ['exception_type', 'message', 'stacktrace', 'stdout', 'stderr']

try:
Expand Down Expand Up @@ -345,10 +345,10 @@ def handler(self, request, pk=None):
instance.origin_result.outcome = instance.outcome
instance.origin_result.save()

return Response(data='Result has been saved.')
return Response(data={'message': 'Result has been saved.'})

except Exception as e:
logger.exception('Failed to handle reset result: {}'.format(pk))
instance.reset_status = 3 # failed
instance.save()
return Response(data=str(e.args), status=400)
return Response(data={'message': str(e.args)}, status=400)

0 comments on commit c06d1c1

Please sign in to comment.