mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 05:59:44 -04:00
Stop the user fixtures being called as a functions from conftest
Stopped fixtures in conftest.py from calling the fixtures which return user json as if they were functions. Deleted two fixtures that are now no longer needed as a result of the changes to conftest.py.
This commit is contained in:
@@ -12,13 +12,7 @@ from app.main.views.feedback import (
|
||||
has_live_services,
|
||||
in_business_hours,
|
||||
)
|
||||
from tests.conftest import (
|
||||
active_user_with_permissions,
|
||||
mock_get_services,
|
||||
mock_get_services_with_no_services,
|
||||
mock_get_services_with_one_service,
|
||||
normalize_spaces,
|
||||
)
|
||||
from tests.conftest import normalize_spaces
|
||||
|
||||
|
||||
def no_redirect():
|
||||
@@ -105,10 +99,10 @@ def test_get_feedback_page_with_prefilled_body(
|
||||
fake_uuid,
|
||||
prefilled_body,
|
||||
expected_textarea,
|
||||
active_user_with_permissions,
|
||||
):
|
||||
user = active_user_with_permissions(fake_uuid)
|
||||
user['email_address'] = 'test@marinemanagement.org.uk'
|
||||
mocker.patch('app.user_api_client.get_user', return_value=user)
|
||||
active_user_with_permissions['email_address'] = 'test@marinemanagement.org.uk'
|
||||
mocker.patch('app.user_api_client.get_user', return_value=active_user_with_permissions)
|
||||
mock_post = mocker.patch('app.main.views.feedback.zendesk_client.create_ticket')
|
||||
page = client_request.get(
|
||||
'main.feedback',
|
||||
@@ -400,19 +394,16 @@ def test_doesnt_lose_message_if_post_across_closing(
|
||||
assert 'feedback_message' not in session
|
||||
|
||||
|
||||
@pytest.mark.parametrize('get_services_mock, expected_return_value', [
|
||||
(mock_get_services, True),
|
||||
(mock_get_services_with_no_services, False),
|
||||
(mock_get_services_with_one_service, False),
|
||||
])
|
||||
def test_has_live_services(
|
||||
mocker,
|
||||
fake_uuid,
|
||||
get_services_mock,
|
||||
expected_return_value
|
||||
):
|
||||
get_services_mock(mocker, fake_uuid)
|
||||
assert has_live_services(12345) == expected_return_value
|
||||
def test_has_live_services(mock_get_services):
|
||||
assert has_live_services(12345) is True
|
||||
|
||||
|
||||
def test_has_live_services_when_there_are_no_services(mock_get_services_with_no_services):
|
||||
assert has_live_services(12345) is False
|
||||
|
||||
|
||||
def test_has_live_services_when_service_is_not_live(mock_get_services_with_one_service):
|
||||
assert has_live_services(12345) is False
|
||||
|
||||
|
||||
@pytest.mark.parametrize('when, is_in_business_hours', [
|
||||
|
||||
@@ -3,7 +3,7 @@ from flask import Response, url_for
|
||||
from notifications_python_client.errors import HTTPError
|
||||
|
||||
import app
|
||||
from tests.conftest import api_user_active as create_active_user
|
||||
from tests import user_json
|
||||
|
||||
|
||||
def test_should_render_forgot_password(client):
|
||||
@@ -23,7 +23,7 @@ def test_should_redirect_to_password_reset_sent_for_valid_email(
|
||||
email_address,
|
||||
mocker,
|
||||
):
|
||||
sample_user = create_active_user(fake_uuid, email_address=email_address)
|
||||
sample_user = user_json(email_address=email_address)
|
||||
mocker.patch('app.user_api_client.send_reset_password_url', return_value=None)
|
||||
response = client.post(
|
||||
url_for('.forgot_password'),
|
||||
|
||||
@@ -762,6 +762,7 @@ def test_should_check_for_sending_things_right(
|
||||
count_of_email_templates,
|
||||
reply_to_email_addresses,
|
||||
expected_reply_to_checklist_item,
|
||||
active_user_with_permissions,
|
||||
):
|
||||
def _templates_by_type(template_type):
|
||||
return {
|
||||
@@ -772,7 +773,7 @@ def test_should_check_for_sending_things_right(
|
||||
mock_get_users = mocker.patch(
|
||||
'app.models.user.Users.client',
|
||||
return_value=(
|
||||
[active_user_with_permissions(fake_uuid)] * count_of_users_with_manage_service +
|
||||
[active_user_with_permissions] * count_of_users_with_manage_service +
|
||||
[active_user_no_settings_permission(fake_uuid)]
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user