mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-18 15:54:51 -04:00
more tests
This commit is contained in:
@@ -267,7 +267,7 @@ def test_choose_account_should_not_show_back_to_service_link_if_not_signed_in(
|
||||
|
||||
@pytest.mark.parametrize('active', (
|
||||
False,
|
||||
pytest.param(True, marks=pytest.mark.xfail(raises=AssertionError)),
|
||||
pytest.param(True),
|
||||
))
|
||||
def test_choose_account_should_not_show_back_to_service_link_if_service_archived(
|
||||
client_request,
|
||||
@@ -283,7 +283,10 @@ def test_choose_account_should_not_show_back_to_service_link_if_service_archived
|
||||
page = client_request.get('main.choose_account')
|
||||
|
||||
assert normalize_spaces(page.select_one('h1').text) == 'Choose service'
|
||||
assert page.select_one('.navigation-service a') is None
|
||||
if active:
|
||||
assert page.select_one('.navigation-service a') is not None
|
||||
else:
|
||||
assert page.select_one('.navigation-service a') is None
|
||||
|
||||
|
||||
def test_should_not_show_back_to_service_if_user_doesnt_belong_to_service(
|
||||
|
||||
@@ -122,10 +122,6 @@ def test_service_setting_toggles_show(
|
||||
({'active': True}, '.history', 2, 'Service history'),
|
||||
({'active': False}, '.resume_service', 0, 'Resume service'),
|
||||
({'active': False}, '.history', 1, 'Service history'),
|
||||
pytest.param(
|
||||
{'active': False}, '.archive_service', 2, 'Resume service',
|
||||
marks=pytest.mark.xfail(raises=IndexError)
|
||||
)
|
||||
])
|
||||
def test_service_setting_link_toggles(
|
||||
get_service_settings_page,
|
||||
@@ -143,6 +139,26 @@ def test_service_setting_link_toggles(
|
||||
assert link['href'] == link_url
|
||||
|
||||
|
||||
@pytest.mark.parametrize('service_fields, endpoint, index, text', [
|
||||
pytest.param(
|
||||
{'active': False}, '.archive_service', 2, 'Resume service',
|
||||
)
|
||||
])
|
||||
def test_service_setting_link_toggles_index_error(
|
||||
get_service_settings_page,
|
||||
service_one,
|
||||
service_fields,
|
||||
endpoint,
|
||||
index,
|
||||
text,
|
||||
):
|
||||
with pytest.raises(expected_exception=IndexError):
|
||||
url_for(endpoint, service_id=service_one['id'])
|
||||
service_one.update(service_fields)
|
||||
page = get_service_settings_page()
|
||||
page.select('.page-footer-link a')[index]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('permissions,permissions_text,visible', [
|
||||
('sms', 'inbound SMS', True),
|
||||
('inbound_sms', 'inbound SMS', False), # no sms parent permission
|
||||
|
||||
@@ -3452,7 +3452,7 @@ def test_suspend_service_after_confirm_error(
|
||||
|
||||
@pytest.mark.parametrize('user', (
|
||||
create_platform_admin_user(),
|
||||
pytest.param(create_active_user_with_permissions(), marks=pytest.mark.xfail),
|
||||
pytest.param(create_active_user_with_permissions()),
|
||||
))
|
||||
def test_suspend_service_prompts_user(
|
||||
client_request,
|
||||
@@ -3466,6 +3466,12 @@ def test_suspend_service_prompts_user(
|
||||
mock_api = mocker.patch('app.service_api_client.post')
|
||||
|
||||
client_request.login(user)
|
||||
|
||||
if user['email_address'] != 'platform@admin.gsa.gov':
|
||||
with pytest.raises(expected_exception=AssertionError):
|
||||
client_request.get('main.suspend_service', service_id=service_one['id'])
|
||||
return
|
||||
|
||||
page = client_request.get('main.suspend_service', service_id=service_one['id'])
|
||||
|
||||
assert 'This will suspend the service and revoke all api keys. Are you sure you want to suspend this service?' in \
|
||||
|
||||
@@ -191,7 +191,7 @@ def test_should_show_change_details_link(
|
||||
|
||||
|
||||
@pytest.mark.parametrize('number_of_users', (
|
||||
pytest.param(7, marks=pytest.mark.xfail),
|
||||
pytest.param(7),
|
||||
pytest.param(8),
|
||||
))
|
||||
def test_should_show_live_search_if_more_than_7_users(
|
||||
@@ -213,6 +213,13 @@ def test_should_show_live_search_if_more_than_7_users(
|
||||
|
||||
page = client_request.get('main.manage_users', service_id=SERVICE_ONE_ID)
|
||||
|
||||
if number_of_users == 7:
|
||||
with pytest.raises(expected_exception=TypeError):
|
||||
assert page.select_one('div[data-module=live-search]')['data-targets'] == (
|
||||
".user-list-item"
|
||||
)
|
||||
return
|
||||
|
||||
assert page.select_one('div[data-module=live-search]')['data-targets'] == (
|
||||
".user-list-item"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user