mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 10:28:41 -04:00
Merge pull request #2287 from alphagov/remove-old-key-info-2
Remove old API key and service ID combo
This commit is contained in:
@@ -32,17 +32,4 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 class='heading-medium'>For older API clients</h2>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
If the client you’re using needs a service ID and an API key,
|
|
||||||
use these values:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="bottom-gutter">
|
|
||||||
{{ api_key(service_id, 'Service ID', thing='service ID') }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{ api_key(secret, 'API key') }}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ def test_should_show_create_api_key_page(
|
|||||||
|
|
||||||
|
|
||||||
def test_should_create_api_key_with_type_normal(
|
def test_should_create_api_key_with_type_normal(
|
||||||
logged_in_client,
|
client_request,
|
||||||
api_user_active,
|
api_user_active,
|
||||||
mock_login,
|
mock_login,
|
||||||
mock_get_api_keys,
|
mock_get_api_keys,
|
||||||
@@ -258,27 +258,22 @@ def test_should_create_api_key_with_type_normal(
|
|||||||
mocker,
|
mocker,
|
||||||
):
|
):
|
||||||
post = mocker.patch('app.notify_client.api_key_api_client.ApiKeyApiClient.post', return_value={'data': fake_uuid})
|
post = mocker.patch('app.notify_client.api_key_api_client.ApiKeyApiClient.post', return_value={'data': fake_uuid})
|
||||||
service_id = str(uuid.uuid4())
|
|
||||||
|
|
||||||
response = logged_in_client.post(
|
page = client_request.post(
|
||||||
url_for('main.create_api_key', service_id=service_id),
|
'main.create_api_key',
|
||||||
data={
|
service_id=SERVICE_ONE_ID,
|
||||||
|
_data={
|
||||||
'key_name': 'Some default key name 1/2',
|
'key_name': 'Some default key name 1/2',
|
||||||
'key_type': 'normal'
|
'key_type': 'normal'
|
||||||
}
|
},
|
||||||
|
_expected_status=200,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert response.status_code == 200
|
assert page.select_one('span.api-key-key').text.strip() == (
|
||||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
'some_default_key_name_12-{}-{}'.format(SERVICE_ONE_ID, fake_uuid)
|
||||||
keys = page.find_all('span', {'class': 'api-key-key'})
|
)
|
||||||
for index, key in enumerate([
|
|
||||||
'some_default_key_name_12-{}-{}'.format(service_id, fake_uuid),
|
|
||||||
service_id,
|
|
||||||
fake_uuid
|
|
||||||
]):
|
|
||||||
assert keys[index].text.strip() == key
|
|
||||||
|
|
||||||
post.assert_called_once_with(url='/service/{}/api-key'.format(service_id), data={
|
post.assert_called_once_with(url='/service/{}/api-key'.format(SERVICE_ONE_ID), data={
|
||||||
'name': 'Some default key name 1/2',
|
'name': 'Some default key name 1/2',
|
||||||
'key_type': 'normal',
|
'key_type': 'normal',
|
||||||
'created_by': api_user_active.id
|
'created_by': api_user_active.id
|
||||||
|
|||||||
Reference in New Issue
Block a user