def test_should_show_caseworker_on_overview_page(
    client_request,
    mocker,
    mock_get_invites_for_service,
    fake_uuid,
    service_one,
):
    service_one['permissions'].append('caseworking')
    current_user = active_user_view_permissions(active_user_view_permissions)
    other_user = active_caseworking_user(fake_uuid)
    other_user.email_address = '*****@*****.**'

    mocker.patch('app.user_api_client.get_user', return_value=current_user)
    mocker.patch('app.user_api_client.get_users_for_service',
                 return_value=[
                     current_user,
                     other_user,
                 ])

    page = client_request.get('main.manage_users', service_id=SERVICE_ONE_ID)

    assert normalize_spaces(page.select_one('h1').text) == 'Team members'
    assert normalize_spaces(page.select('.user-list-item')[0].text) == (
        'Test User With Permissions (you) '
        'Can Admin view '
        'Can’t Send messages '
        'Can’t Add and edit templates '
        'Can’t Manage service '
        'Can’t Access API keys')
    # [1:5] are invited users
    assert normalize_spaces(page.select('.user-list-item')[6].text) == (
        'Test User [email protected] '
        'Can Basic view')
Esempio n. 2
0
def test_caseworkers_get_caseworking_navigation(
    client_request,
    mocker,
    fake_uuid,
    mock_get_service_templates,
):
    mocker.patch('app.user_api_client.get_user',
                 return_value=active_caseworking_user(fake_uuid))
    page = client_request.get('main.choose_template',
                              service_id=SERVICE_ONE_ID)
    assert normalize_spaces(page.select_one('#content nav').text) == (
        'Send a message Sent messages')
Esempio n. 3
0
def test_caseworkers_see_jobs_nav_if_jobs_exist(
    client_request,
    mocker,
    fake_uuid,
    mock_get_service_templates,
    mock_has_jobs,
):
    mocker.patch('app.user_api_client.get_user',
                 return_value=active_caseworking_user(fake_uuid))
    page = client_request.get('main.choose_template',
                              service_id=SERVICE_ONE_ID)
    assert normalize_spaces(page.select_one('#content nav').text) == (
        'Templates Sent messages Uploaded files Team members')
def test_should_show_caseworker_on_overview_page(
    client_request,
    mocker,
    mock_get_invites_for_service,
    mock_get_template_folders,
    fake_uuid,
    service_one,
):
    service_one['permissions'].append('caseworking')
    current_user = active_user_view_permissions(fake_uuid)
    other_user = active_caseworking_user(uuid.uuid4())
    other_user['email_address'] = '*****@*****.**'

    mocker.patch('app.user_api_client.get_user', return_value=current_user)
    mocker.patch('app.models.user.Users.client', return_value=[
        current_user,
        other_user,
    ])

    page = client_request.get('main.manage_users', service_id=SERVICE_ONE_ID)

    assert normalize_spaces(page.select_one('h1').text) == 'Team members'
    assert normalize_spaces(page.select('.user-list-item')[0].text) == (
        'Test User With Permissions (you) '
        'Can See dashboard '
        'Can’t Send messages '
        'Can’t Add and edit templates '
        'Can’t Manage settings and teams '
        'Can’t Manage API integration'
    )
    # [1:5] are invited users
    assert normalize_spaces(page.select('.user-list-item')[6].text) == (
        'Test User [email protected] '
        'Can’t See dashboard '
        'Can Send messages '
        'Can’t Add and edit templates '
        'Can’t Manage settings and teams '
        'Can’t Manage API integration'
    )
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,
        ),
    )