Let caseworkers send one off messages

The main task that we think ‘caseworker’ users do is send one off
messages.

So this commit:
- makes sure users who don’t have the `view_activity` permission (ie
  not ‘admin’ users) can still send messages
- adds navigation so that these users have a place to go from which to
  start the process of sending a one off message
This commit is contained in:
Chris Hill-Scott
2018-06-12 16:17:20 +01:00
parent 2855cf45c7
commit 84de1c5625
11 changed files with 489 additions and 91 deletions

View File

@@ -18,6 +18,7 @@ from tests import (
)
from tests.conftest import (
SERVICE_ONE_ID,
active_caseworking_user,
mock_get_service_email_template,
mock_get_service_letter_template,
mock_get_service_template,
@@ -110,6 +111,29 @@ def test_should_show_page_for_one_template(
mock_get_service_template.assert_called_with(service_one['id'], template_id)
def test_caseworker_redirected_to_one_off(
client_request,
mock_get_service_templates,
mocker,
fake_uuid,
):
mocker.patch('app.user_api_client.get_user', return_value=active_caseworking_user(fake_uuid))
client_request.get(
'main.view_template',
service_id=SERVICE_ONE_ID,
template_id=fake_uuid,
_expected_status=302,
_expected_redirect=url_for(
'main.send_one_off',
service_id=SERVICE_ONE_ID,
template_id=fake_uuid,
_external=True,
),
)
@pytest.mark.parametrize('permissions, links_to_be_shown, permissions_warning_to_be_shown', [
(
['view_activity'],