Replaced first queries with one queries, which throws a NoResultFound.

Able to remove many of the None checks as a result of this.
Fixed the tests were needed.
This commit is contained in:
Rebecca Law
2016-03-11 15:34:20 +00:00
parent ef5969be77
commit 123b0ead3a
14 changed files with 26 additions and 66 deletions
-3
View File
@@ -29,8 +29,6 @@ register_errors(job)
@job.route('/<job_id>', methods=['GET'])
def get_job_by_service_and_job_id(service_id, job_id):
job = dao_get_job_by_service_id_and_job_id(service_id, job_id)
if not job:
return jsonify(result="error", message="Job {} not found for service {}".format(job_id, service_id)), 404
data, errors = job_schema.dump(job)
return jsonify(data=data)
@@ -44,7 +42,6 @@ def get_jobs_by_service(service_id):
@job.route('', methods=['POST'])
def create_job(service_id):
dao_fetch_service_by_id(service_id)
data = request.get_json()