mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
DRY-up creating auth headers for requests
The rest of the tests need to construct the header directly so they can pass custom tokens. But for the three tests that actually make a request to prove the auth functions work as wrappers, we can use the same factory functions we use everywhere else in the tests.
This commit is contained in:
@@ -32,6 +32,10 @@ def create_service_authorization_header(service_id, key_type=KEY_TYPE_NORMAL):
|
||||
|
||||
def create_admin_authorization_header():
|
||||
client_id = current_app.config['ADMIN_CLIENT_ID']
|
||||
return create_internal_authorization_header(client_id)
|
||||
|
||||
|
||||
def create_internal_authorization_header(client_id):
|
||||
secret = current_app.config['INTERNAL_CLIENT_API_KEYS'][client_id][0]
|
||||
token = create_jwt_token(secret=secret, client_id=client_id)
|
||||
return 'Authorization', 'Bearer {}'.format(token)
|
||||
|
||||
Reference in New Issue
Block a user