From d5d1f7394d2bf2c97a8e4e7eb7c930e1cb1cfb95 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 22 Feb 2017 15:40:48 +0000 Subject: [PATCH] Remove old API key and service ID combo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Once all our users have upgraded to the latest clients they won’t need this. The latest clients only use the combined key and service ID. Discuss: when can we safely remove it? --- app/templates/views/api/keys/show.html | 13 ---------- tests/app/main/views/test_api_integration.py | 27 ++++++++------------ 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/app/templates/views/api/keys/show.html b/app/templates/views/api/keys/show.html index dd907fe93..40f9579a1 100644 --- a/app/templates/views/api/keys/show.html +++ b/app/templates/views/api/keys/show.html @@ -32,17 +32,4 @@ -

For older API clients

- -

- If the client you’re using needs a service ID and an API key, - use these values: -

- -
- {{ api_key(service_id, 'Service ID', thing='service ID') }} -
- - {{ api_key(secret, 'API key') }} - {% endblock %} diff --git a/tests/app/main/views/test_api_integration.py b/tests/app/main/views/test_api_integration.py index 34d53b804..e393e3c44 100644 --- a/tests/app/main/views/test_api_integration.py +++ b/tests/app/main/views/test_api_integration.py @@ -248,7 +248,7 @@ def test_should_show_create_api_key_page( def test_should_create_api_key_with_type_normal( - logged_in_client, + client_request, api_user_active, mock_login, mock_get_api_keys, @@ -258,27 +258,22 @@ def test_should_create_api_key_with_type_normal( mocker, ): 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( - url_for('main.create_api_key', service_id=service_id), - data={ + page = client_request.post( + 'main.create_api_key', + service_id=SERVICE_ONE_ID, + _data={ 'key_name': 'Some default key name 1/2', 'key_type': 'normal' - } + }, + _expected_status=200, ) - assert response.status_code == 200 - page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - 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 + assert page.select_one('span.api-key-key').text.strip() == ( + 'some_default_key_name_12-{}-{}'.format(SERVICE_ONE_ID, fake_uuid) + ) - 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', 'key_type': 'normal', 'created_by': api_user_active.id