mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Merge pull request #3815 from alphagov/permissions-bug
allow caseworkers to view letter previews
This commit is contained in:
@@ -197,7 +197,7 @@ def get_preview_error_image():
|
|||||||
|
|
||||||
|
|
||||||
@main.route("/services/<uuid:service_id>/notification/<uuid:notification_id>.<letter_file_extension:filetype>")
|
@main.route("/services/<uuid:service_id>/notification/<uuid:notification_id>.<letter_file_extension:filetype>")
|
||||||
@user_has_permissions('view_activity')
|
@user_has_permissions('view_activity', 'send_messages')
|
||||||
def view_letter_notification_as_preview(
|
def view_letter_notification_as_preview(
|
||||||
service_id, notification_id, filetype, with_metadata=False
|
service_id, notification_id, filetype, with_metadata=False
|
||||||
):
|
):
|
||||||
|
|||||||
@@ -610,12 +610,19 @@ def test_notification_page_shows_page_for_other_postage_classes(
|
|||||||
@pytest.mark.parametrize('filetype', [
|
@pytest.mark.parametrize('filetype', [
|
||||||
'pdf', 'png'
|
'pdf', 'png'
|
||||||
])
|
])
|
||||||
|
@pytest.mark.parametrize('user', [
|
||||||
|
create_active_user_with_permissions(),
|
||||||
|
create_active_caseworking_user(),
|
||||||
|
])
|
||||||
def test_should_show_image_of_letter_notification(
|
def test_should_show_image_of_letter_notification(
|
||||||
logged_in_client,
|
logged_in_client,
|
||||||
fake_uuid,
|
fake_uuid,
|
||||||
mocker,
|
mocker,
|
||||||
filetype,
|
filetype,
|
||||||
|
user,
|
||||||
):
|
):
|
||||||
|
mocker.patch('app.user_api_client.get_user', return_value=user)
|
||||||
|
|
||||||
notification = create_notification(template_type='letter')
|
notification = create_notification(template_type='letter')
|
||||||
mocker.patch('app.notification_api_client.get_notification', return_value=notification)
|
mocker.patch('app.notification_api_client.get_notification', return_value=notification)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user