mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 00:20:43 -04:00
Revert "Revert "Don’t let people create a normal key in trial mode""
Reverts alphagov/notifications-admin#976
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user