mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
This is a temporary endpoint to get history of service and api key
updates. This will be surfaced on a simple log page on admin app until product team work out who/how/when etc. of viewing history data.
This commit is contained in:
@@ -981,3 +981,28 @@ def test_cannot_remove_only_user_from_service(notify_api,
|
||||
assert resp.status_code == 400
|
||||
result = json.loads(resp.get_data(as_text=True))
|
||||
assert result['message'] == 'You cannot remove the only user for a service'
|
||||
|
||||
|
||||
# This test is just here verify get_service_and_api_key_history that is a temp solution
|
||||
# until proper ui is sorted out on admin app
|
||||
def test_get_service_and_api_key_history(notify_api, notify_db, notify_db_session, sample_service):
|
||||
|
||||
from tests.app.conftest import sample_api_key as create_sample_api_key
|
||||
api_key = create_sample_api_key(notify_db, notify_db_session, service=sample_service)
|
||||
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
|
||||
auth_header = create_authorization_header(
|
||||
path='/service/{}/history'.format(sample_service.id),
|
||||
method='GET'
|
||||
)
|
||||
response = client.get(
|
||||
path='/service/{}/history'.format(sample_service.id),
|
||||
headers=[auth_header]
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
json_resp = json.loads(response.get_data(as_text=True))
|
||||
assert json_resp['data']['service_history'][0]['id'] == str(sample_service.id)
|
||||
assert json_resp['data']['api_key_history'][0]['id'] == str(api_key.id)
|
||||
|
||||
Reference in New Issue
Block a user