mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-04 05:31:44 -04:00
Merge pull request #2906 from alphagov/auto-service-counts
Automate counting of live services and orgs
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
def test_owasp_useful_headers_set(client, mocker):
|
||||
|
||||
|
||||
def test_owasp_useful_headers_set(
|
||||
client,
|
||||
mocker,
|
||||
mock_get_service_and_organisation_counts,
|
||||
):
|
||||
mocker.patch('app.get_logo_cdn_domain', return_value='static-logos.test.com')
|
||||
|
||||
response = client.get('/')
|
||||
@@ -19,7 +25,11 @@ def test_owasp_useful_headers_set(client, mocker):
|
||||
)
|
||||
|
||||
|
||||
def test_headers_non_ascii_characters_are_replaced(client, mocker):
|
||||
def test_headers_non_ascii_characters_are_replaced(
|
||||
client,
|
||||
mocker,
|
||||
mock_get_service_and_organisation_counts,
|
||||
):
|
||||
mocker.patch('app.get_logo_cdn_domain', return_value='static-logos۾.test.com')
|
||||
|
||||
response = client.get('/')
|
||||
|
||||
@@ -14,6 +14,7 @@ from tests.conftest import (
|
||||
|
||||
def test_non_logged_in_user_can_see_homepage(
|
||||
client,
|
||||
mock_get_service_and_organisation_counts,
|
||||
):
|
||||
response = client.get(url_for('main.index'))
|
||||
assert response.status_code == 200
|
||||
@@ -30,6 +31,18 @@ def test_non_logged_in_user_can_see_homepage(
|
||||
'local authority, or the NHS.'
|
||||
)
|
||||
|
||||
assert normalize_spaces(page.select_one('#whos-using-notify').text) == (
|
||||
'Who’s using GOV.UK Notify '
|
||||
'Services '
|
||||
'9999 services '
|
||||
'Organisations '
|
||||
'111 organisations '
|
||||
'See the list of services and organisations.'
|
||||
)
|
||||
assert page.select_one('#whos-using-notify a')['href'] == (
|
||||
'https://www.gov.uk/performance/govuk-notify/government-services'
|
||||
)
|
||||
|
||||
|
||||
def test_logged_in_user_redirects_to_choose_account(
|
||||
client_request,
|
||||
|
||||
@@ -3351,3 +3351,11 @@ def mock_move_to_template_folder(mocker):
|
||||
@pytest.fixture
|
||||
def mock_create_template_folder(mocker):
|
||||
return mocker.patch('app.template_folder_api_client.create_template_folder', return_value=sample_uuid())
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_service_and_organisation_counts(mocker):
|
||||
return mocker.patch('app.status_api_client.get_count_of_live_services_and_organisations', return_value={
|
||||
'organisations': 111,
|
||||
'services': 9999,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user