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

Reverts alphagov/notifications-admin#976
This commit is contained in:
Chris Hill-Scott
2016-10-11 09:17:18 +01:00
parent d13dbe5066
commit 645e935f55
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,