def test_update_organisation_domains_when_domain_already_exists( mocker, client_request, fake_uuid, organisation_one, mock_get_organisation, ): user = create_platform_admin_user() client_request.login(user) mocker.patch('app.organisations_client.update_organisation', side_effect=HTTPError(response=Mock( status_code=400, json={ 'result': 'error', 'message': 'Domain already exists' }), message="Domain already exists")) response = client_request.post( 'main.edit_organisation_domains', org_id=ORGANISATION_ID, _data={'domains': [ 'example.gov.uk', ]}, _expected_status=200, ) assert response.find("div", class_="banner-dangerous").text.strip( ) == "This domain is already in use"
)) 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.parametrize('user', ( create_platform_admin_user(), create_active_user_with_permissions(), )) def test_all_users_have_upload_contact_list( client_request, mock_get_uploads, mock_get_jobs, mock_get_no_contact_lists, user, ): client_request.login(user) page = client_request.get('main.uploads', service_id=SERVICE_ONE_ID) button = page.find('a', text=re.compile('Upload an emergency contact list')) assert button assert button['href'] == url_for( 'main.upload_contact_list', service_id=SERVICE_ONE_ID,
('Yes ' 'Users will be told their organisation has already signed the agreement' )), ('no', ('No ' 'Users will be prompted to sign the agreement before they can go live' )), ('unknown', ('No (but we have some service-specific agreements in place) ' 'Users will not be prompted to sign the agreement')), ), 'no', ), )) @pytest.mark.parametrize('user', ( pytest.param(create_platform_admin_user(), ), pytest.param(create_active_user_with_permissions(), marks=pytest.mark.xfail), )) def test_view_organisation_settings( client_request, fake_uuid, organisation_one, mock_get_organisation, endpoint, expected_options, expected_selected, user, ): client_request.login(user)