mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-24 04:10:57 -05:00
Add button to uploads page
We need a place where people can get into the contact list journey. This is going to be the uploads page, because that’s where stuff you upload lives. At the moment this is platform-admin only, until we’re ready to launch the feature.
This commit is contained in:
@@ -31,7 +31,10 @@
|
||||
</p>
|
||||
{% endif %}
|
||||
{{ previous_next_navigation(prev_page, next_page) }}
|
||||
{% if current_service.can_upload_letters and current_user.has_permissions('send_messages') %}
|
||||
{% if (
|
||||
current_service.can_upload_letters and
|
||||
current_user.has_permissions('send_messages')
|
||||
) or current_user.platform_admin %}
|
||||
<div class="js-stick-at-bottom-when-scrolling">
|
||||
{{ govukButton({
|
||||
"element": "a",
|
||||
@@ -39,6 +42,14 @@
|
||||
"href": url_for('.upload_letter', service_id=current_service.id),
|
||||
"classes": "govuk-button--secondary"
|
||||
}) }}
|
||||
{% if current_user.platform_admin %}
|
||||
{{ govukButton({
|
||||
"element": "a",
|
||||
"text": "Upload a contact list",
|
||||
"href": url_for('.upload_contact_list', service_id=current_service.id),
|
||||
"classes": "govuk-button--secondary govuk-!-margin-left-3"
|
||||
}) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -15,6 +15,7 @@ from tests.conftest import (
|
||||
SERVICE_ONE_ID,
|
||||
create_active_caseworking_user,
|
||||
create_active_user_with_permissions,
|
||||
create_platform_admin_user,
|
||||
)
|
||||
|
||||
|
||||
@@ -39,6 +40,30 @@ def test_no_upload_letters_button_without_permission(
|
||||
assert not page.find('a', text=re.compile('Upload a letter'))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('user', (
|
||||
pytest.param(
|
||||
create_platform_admin_user(),
|
||||
),
|
||||
pytest.param(
|
||||
create_active_user_with_permissions(),
|
||||
marks=pytest.mark.xfail(raises=AssertionError),
|
||||
),
|
||||
))
|
||||
def test_platform_admin_has_upload_contact_list(
|
||||
client_request,
|
||||
mock_get_uploads,
|
||||
mock_get_jobs,
|
||||
user,
|
||||
):
|
||||
client_request.login(user)
|
||||
page = client_request.get('main.uploads', service_id=SERVICE_ONE_ID)
|
||||
button = page.find('a', text=re.compile('Upload a contact list'))
|
||||
assert button
|
||||
assert button['href'] == url_for(
|
||||
'main.upload_contact_list', service_id=SERVICE_ONE_ID,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('extra_permissions, expected_empty_message', (
|
||||
(['letter'], (
|
||||
'You have not uploaded any files recently. '
|
||||
|
||||
Reference in New Issue
Block a user