From 04999c083f01cb38618def6e5293b44779283338 Mon Sep 17 00:00:00 2001 From: Natasha Singh Date: Mon, 12 Mar 2018 16:03:00 -0400 Subject: [PATCH] :recycle: Participant - update error msgs to standard --- dataservice/api/participant/resources.py | 7 +++---- tests/participant/test_participant_resources.py | 1 - tests/test_api.py | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/dataservice/api/participant/resources.py b/dataservice/api/participant/resources.py index 4ba080c36..3d23a5724 100644 --- a/dataservice/api/participant/resources.py +++ b/dataservice/api/participant/resources.py @@ -1,4 +1,3 @@ -from pprint import pprint from flask import abort, request from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.orm import joinedload @@ -87,7 +86,7 @@ def get(self, kf_id): participant = Participant.query.filter_by(kf_id=kf_id).one() except NoResultFound: abort(404, 'could not find {} `{}`' - .format('Participant', kf_id)) + .format('participant', kf_id)) return ParticipantSchema().jsonify(participant) def patch(self, kf_id): @@ -106,7 +105,7 @@ def patch(self, kf_id): p = Participant.query.filter_by(kf_id=kf_id).one() except NoResultFound: abort(404, 'could not find {} `{}`' - .format('Participant', kf_id)) + .format('participant', kf_id)) # Partial update - validate but allow missing required fields try: @@ -136,7 +135,7 @@ def delete(self, kf_id): try: p = Participant.query.filter_by(kf_id=kf_id).one() except NoResultFound: - abort(404, 'could not find {} `{}`'.format('Participant', kf_id)) + abort(404, 'could not find {} `{}`'.format('participant', kf_id)) db.session.delete(p) db.session.commit() diff --git a/tests/participant/test_participant_resources.py b/tests/participant/test_participant_resources.py index 6d888c7f7..b21ea9357 100644 --- a/tests/participant/test_participant_resources.py +++ b/tests/participant/test_participant_resources.py @@ -1,5 +1,4 @@ import json -from pprint import pprint from datetime import datetime from dateutil import parser, tz diff --git a/tests/test_api.py b/tests/test_api.py index 50067aa1d..7b4379457 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -45,9 +45,9 @@ def test_status_codes(self, client, endpoint, method, status_code): ('/demographics/123', 'PATCH', 'could not find demographic `123`'), ('/demographics/123', 'DELETE', 'could not find demographic `123`'), ('/participants', 'GET', 'success'), - ('/participants/123', 'GET', 'could not find Participant `123`'), - ('/participants/123', 'PATCH', 'could not find Participant `123`'), - ('/participants/123', 'DELETE', 'could not find Participant `123`') + ('/participants/123', 'GET', 'could not find participant `123`'), + ('/participants/123', 'PATCH', 'could not find participant `123`'), + ('/participants/123', 'DELETE', 'could not find participant `123`') ]) def test_status_messages(self, client, endpoint, method, status_message): """