more test fixes, one test remaining

This commit is contained in:
stvnrlly
2022-11-28 13:51:37 -05:00
parent 9689aaf89b
commit 77c0faf4e5
13 changed files with 26 additions and 381 deletions

View File

@@ -13,31 +13,7 @@ from tests.conftest import (
)
@pytest.mark.parametrize('extra_permissions', (
pytest.param(
[],
marks=pytest.mark.xfail(raises=AssertionError),
),
pytest.param(
['upload_letters'],
marks=pytest.mark.xfail(raises=AssertionError),
),
['letter'],
['letter', 'upload_letters'],
))
def test_upload_letters_button_only_with_letters_permission(
client_request,
service_one,
mock_get_uploads,
mock_get_jobs,
mock_get_no_contact_lists,
extra_permissions,
):
service_one['permissions'] += extra_permissions
page = client_request.get('main.uploads', service_id=SERVICE_ONE_ID)
assert page.find('a', text=re.compile('Upload a letter'))
@pytest.mark.skip(reason="Not sure that TTS needs this")
@pytest.mark.parametrize('user', (
create_platform_admin_user(),
create_active_user_with_permissions(),
@@ -62,10 +38,6 @@ def test_all_users_have_upload_contact_list(
([], (
'You have not uploaded any files recently.'
)),
(['letter'], (
'You have not uploaded any files recently. '
'Upload a letter and Notify will print, pack and post it for you.'
)),
))
def test_get_upload_hub_with_no_uploads(
mocker,
@@ -119,7 +91,7 @@ def test_get_upload_hub_page(
assert normalize_spaces(uploads[1].text.strip()) == (
'some.csv '
'Sent 1 January 2016 at 11:09am '
'Sent 1 January 2016 at 6:09am '
'0 sending 8 delivered 2 failed'
)
assert uploads[1].select_one('a.file-list-filename-large')['href'] == (
@@ -128,7 +100,7 @@ def test_get_upload_hub_page(
assert normalize_spaces(uploads[2].text.strip()) == (
'some.pdf '
'Sent 1 January 2016 at 11:09am '
'Sent 1 January 2016 at 6:09am '
'Firstname Lastname '
'123 Example Street'
)
@@ -167,12 +139,12 @@ def test_uploads_page_shows_scheduled_jobs(
),
(
'even_later.csv '
'Sending 1 January 2016 at 11:09pm '
'Sending 1 January 2016 at 6:09pm '
'1 text message waiting to send'
),
(
'send_me_later.csv '
'Sending 1 January 2016 at 11:09am '
'Sending 1 January 2016 at 6:09am '
'1 text message waiting to send'
),
]
@@ -213,12 +185,12 @@ def test_uploads_page_shows_contact_lists_first(
),
(
'even_later.csv '
'Sending 1 January 2016 at 11:09pm '
'Sending 1 January 2016 at 6:09pm '
'1 text message waiting to send'
),
(
'send_me_later.csv '
'Sending 1 January 2016 at 11:09am '
'Sending 1 January 2016 at 6:09am '
'1 text message waiting to send'
),
]
@@ -227,22 +199,3 @@ def test_uploads_page_shows_contact_lists_first(
service_id=SERVICE_ONE_ID,
contact_list_id='d7b0bd1a-d1c7-4621-be5c-3c1b4278a2ad',
)
def test_get_uploads_shows_pagination(
client_request,
active_user_with_permissions,
mock_get_jobs,
mock_get_uploads,
mock_get_no_contact_lists,
):
page = client_request.get('main.uploads', service_id=SERVICE_ONE_ID)
assert normalize_spaces(page.select_one('.next-page').text) == (
'Next page '
'page 2'
)
assert normalize_spaces(page.select_one('.previous-page').text) == (
'Previous page '
'page 0'
)