Improvements to the tests.

Update AuthError with a to_dict_v2 method.
This commit is contained in:
Rebecca Law
2016-11-01 10:33:34 +00:00
parent a358f3cb3a
commit 482d10545b
8 changed files with 58 additions and 46 deletions

View File

@@ -12,8 +12,15 @@ from app.dao.services_dao import dao_fetch_service_by_id
class AuthError(Exception):
def __init__(self, message, code):
self.message = {"token": [message]}
self.short_message = message
self.code = code
def to_dict_v2(self):
return {'code': self.code,
'message': self.short_message,
'fields': self.message,
'link': 'link to docs'}
def get_auth_token(req):
auth_header = req.headers.get('Authorization', None)