mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-17 18:52:30 -05:00
Improvements to the tests.
Update AuthError with a to_dict_v2 method.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user