Don’t let people create a normal key in trial mode

You can’t properly use a normal key when your service is in trial mode.

It’s theoretically useful to create a live key in preparation for going
live. This utitily outweighs the confusion it causes for people creating
their first keys in trial mode.

We should just remove the confusing option.
This commit is contained in:
Chris Hill-Scott
2016-10-07 14:52:19 +01:00
parent 5bb700ac81
commit 90d4fcaa52
2 changed files with 32 additions and 6 deletions

View File

@@ -147,7 +147,7 @@ def test_should_create_api_key_with_type_normal(app_,
api_user_active,
mock_login,
mock_get_api_keys,
mock_get_service,
mock_get_live_service,
mock_has_permissions,
fake_uuid,
mocker):
@@ -173,6 +173,33 @@ def test_should_create_api_key_with_type_normal(app_,
})
def test_cant_create_normal_api_key_in_trial_mode(
client,
api_user_active,
mock_login,
mock_get_api_keys,
mock_get_service,
mock_has_permissions,
fake_uuid,
mocker
):
mock_post = mocker.patch('app.notify_client.api_key_api_client.ApiKeyApiClient.post')
client.login(api_user_active)
response = client.post(
url_for('main.create_api_key', service_id=uuid.uuid4()),
data={
'key_name': 'some default key name',
'key_type': 'normal'
}
)
assert response.status_code == 200
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert page.find('span', {'class': 'error-message'}).text.strip() == 'Not a valid choice'
mock_post.assert_not_called()
def test_should_show_confirm_revoke_api_key(app_,
api_user_active,
mock_login,