mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
Download CSV option now available.
App is updated to use the rebased db.
This commit is contained in:
@@ -45,18 +45,18 @@ def test_should_show_api_keys_page(app_,
|
||||
mock_get_user_by_email,
|
||||
mock_get_api_keys,
|
||||
mock_get_service,
|
||||
mock_has_permissions):
|
||||
mock_has_permissions,
|
||||
fake_uuid):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
client.login(api_user_active)
|
||||
service_id = str(uuid.uuid4())
|
||||
response = client.get(url_for('main.api_keys', service_id=service_id))
|
||||
response = client.get(url_for('main.api_keys', service_id=fake_uuid))
|
||||
|
||||
assert response.status_code == 200
|
||||
assert 'some key name' in response.get_data(as_text=True)
|
||||
assert 'another key name' in response.get_data(as_text=True)
|
||||
assert 'Revoked Thursday 01 January 1970 at 00:00' in response.get_data(as_text=True)
|
||||
mock_get_api_keys.assert_called_once_with(service_id=service_id)
|
||||
mock_get_api_keys.assert_called_once_with(service_id=fake_uuid)
|
||||
|
||||
|
||||
def test_should_show_name_api_key_page(app_,
|
||||
@@ -104,16 +104,16 @@ def test_should_show_confirm_revoke_api_key(app_,
|
||||
mock_get_user_by_email,
|
||||
mock_get_api_keys,
|
||||
mock_get_service,
|
||||
mock_has_permissions):
|
||||
mock_has_permissions,
|
||||
fake_uuid):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
client.login(api_user_active)
|
||||
service_id = str(uuid.uuid4())
|
||||
response = client.get(url_for('main.revoke_api_key', service_id=service_id, key_id=321))
|
||||
response = client.get(url_for('main.revoke_api_key', service_id=fake_uuid, key_id=fake_uuid))
|
||||
|
||||
assert response.status_code == 200
|
||||
assert 'some key name' in response.get_data(as_text=True)
|
||||
mock_get_api_keys.assert_called_once_with(service_id=service_id, key_id=321)
|
||||
mock_get_api_keys.assert_called_once_with(service_id=fake_uuid, key_id=fake_uuid)
|
||||
|
||||
|
||||
def test_should_redirect_after_revoking_api_key(app_,
|
||||
@@ -124,17 +124,17 @@ def test_should_redirect_after_revoking_api_key(app_,
|
||||
mock_revoke_api_key,
|
||||
mock_get_api_keys,
|
||||
mock_get_service,
|
||||
mock_has_permissions):
|
||||
mock_has_permissions,
|
||||
fake_uuid):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
client.login(api_user_active)
|
||||
service_id = str(uuid.uuid4())
|
||||
response = client.post(url_for('main.revoke_api_key', service_id=service_id, key_id=321))
|
||||
response = client.post(url_for('main.revoke_api_key', service_id=fake_uuid, key_id=fake_uuid))
|
||||
|
||||
assert response.status_code == 302
|
||||
assert response.location == url_for('.api_keys', service_id=service_id, _external=True)
|
||||
mock_revoke_api_key.assert_called_once_with(service_id=service_id, key_id=321)
|
||||
mock_get_api_keys.assert_called_once_with(service_id=service_id, key_id=321)
|
||||
assert response.location == url_for('.api_keys', service_id=fake_uuid, _external=True)
|
||||
mock_revoke_api_key.assert_called_once_with(service_id=fake_uuid, key_id=fake_uuid)
|
||||
mock_get_api_keys.assert_called_once_with(service_id=fake_uuid, key_id=fake_uuid)
|
||||
|
||||
|
||||
def test_route_permissions(mocker,
|
||||
|
||||
Reference in New Issue
Block a user