diff --git a/middle_layer/allocate/application_layer/rest_api/test/test_allocation_dispositions.py b/middle_layer/allocate/application_layer/rest_api/test/test_allocation_dispositions.py index b44a75d1b6d065d027d51aaf5c766f2282cf6e8f..3eab5646c2942aff73507f0a3407311ffba81185 100644 --- a/middle_layer/allocate/application_layer/rest_api/test/test_allocation_dispositions.py +++ b/middle_layer/allocate/application_layer/rest_api/test/test_allocation_dispositions.py @@ -43,9 +43,7 @@ def cleanup(sol, repo): repo.session.commit() -def create_context_for_test( - repo: ORMRepository, -) -> str: +def create_context_for_test(repo: ORMRepository, requests_mock_notify_good: Mocker) -> str: global solicitation_id context = Context(repo.session) pp: ProposalProcess = repo.proposal_process_repo.by_name("Panel Proposal Review") @@ -60,9 +58,13 @@ def create_context_for_test( @pytest.fixture() -def context(repo: ORMRepository): +def context(repo: ORMRepository, requests_mock_notify_good: Mocker): global solicitation_id - return Context(repo.session, solicitation_id) if solicitation_id else create_context_for_test(repo) + return ( + Context(repo.session, solicitation_id) + if solicitation_id + else create_context_for_test(repo, requests_mock_notify_good) + ) def test_allocation_version_list_bad_not_tta_member( diff --git a/middle_layer/allocate/application_layer/rest_api/test/test_allocation_versions.py b/middle_layer/allocate/application_layer/rest_api/test/test_allocation_versions.py index 064de7ed10d29b3a1bd4cb4dc2d9092964782f80..51649c1ab855dbd2b8d2c041075bdb98c4ccbd8a 100644 --- a/middle_layer/allocate/application_layer/rest_api/test/test_allocation_versions.py +++ b/middle_layer/allocate/application_layer/rest_api/test/test_allocation_versions.py @@ -38,9 +38,7 @@ TTA_MEMBER_USER_ID = 10 # User ID of 'Amy Mioduszewski_TTA' solicitation_id = None -def create_context_for_test( - repo: ORMRepository, -) -> str: +def create_context_for_test(repo: ORMRepository, requests_mock_notify_good: Mocker) -> str: global solicitation_id context = Context(repo.session) pp: ProposalProcess = repo.proposal_process_repo.by_name("Panel Proposal Review") @@ -55,9 +53,13 @@ def create_context_for_test( @pytest.fixture() -def context(repo: ORMRepository): +def context(repo: ORMRepository, requests_mock_notify_good: Mocker): global solicitation_id - return Context(repo.session, solicitation_id) if solicitation_id else create_context_for_test(repo) + return ( + Context(repo.session, solicitation_id) + if solicitation_id + else create_context_for_test(repo, requests_mock_notify_good) + ) def clean_up_test_allocation_versions(sol: Solicitation, repo: ORMRepository): diff --git a/middle_layer/allocate/domain_layer/services/test/test_create_allocation_version.py b/middle_layer/allocate/domain_layer/services/test/test_create_allocation_version.py index 617ff97f4f0b9b6b92ac1d414b6c60b5b969ef4e..4c26153e34c0d5151325debca98f58040e0f56c3 100644 --- a/middle_layer/allocate/domain_layer/services/test/test_create_allocation_version.py +++ b/middle_layer/allocate/domain_layer/services/test/test_create_allocation_version.py @@ -37,9 +37,7 @@ TTA_MEMBER_USER_ID = 10 # User ID of 'Amy Mioduszewski_TTA' solicitation_id = None -def create_context_for_test( - repo: ORMRepository, -) -> str: +def create_context_for_test(repo: ORMRepository, requests_mock_notify_good: Mocker) -> str: global solicitation_id context = Context(repo.session) pp: ProposalProcess = repo.proposal_process_repo.by_name("Panel Proposal Review") @@ -54,9 +52,14 @@ def create_context_for_test( @pytest.fixture() -def context(repo: ORMRepository): +def context(repo: ORMRepository, requests_mock_notify_good: Mocker): global solicitation_id - return Context(repo.session, solicitation_id) if solicitation_id else create_context_for_test(repo) + # We need to use a mocker due to the context creation requiring proposals to be submitted + return ( + Context(repo.session, solicitation_id) + if solicitation_id + else create_context_for_test(repo, requests_mock_notify_good) + ) def test_create_allocation_versions_good(repo: ORMRepository, context):