@@ -544,12 +544,26 @@ def test_resume_all_processes_value_error(test_client, mocked_processes_resumeal
544544)
545545def test_create_process_reporter (test_client , fastapi_app , oidc_user , reporter , expected_user ):
546546 # given
547+ async def allow (_ : object ) -> bool :
548+ return True
549+
550+ fake_workflow = make_workflow (
551+ f = lambda _ : None ,
552+ description = "fake" ,
553+ initial_input_form = None ,
554+ target = Target .CREATE ,
555+ steps = StepList ([]),
556+ authorize_callback = allow ,
557+ retry_auth_callback = allow ,
558+ )
547559 url_params = {"reporter" : reporter } if reporter is not None else {}
548560 fastapi_depends = {authenticate : lambda : oidc_user }
549561 with (
562+ mock .patch ("orchestrator.api.api_v1.endpoints.processes.get_workflow" ) as mock_get_workflow ,
550563 mock .patch ("orchestrator.api.api_v1.endpoints.processes.start_process" ) as mock_start_process ,
551564 mock .patch .dict (fastapi_app .dependency_overrides , fastapi_depends ),
552565 ):
566+ mock_get_workflow .return_value = fake_workflow
553567 mock_start_process .return_value = uuid .uuid4 ()
554568 # when
555569 response = test_client .post ("/api/processes/fake_workflow" , json = [], params = url_params )
@@ -609,7 +623,7 @@ def test_new_process_higher_version_invalid(test_client, generic_subscription_1)
609623
610624
611625def test_unauthorized_to_run_process (test_client ):
612- def disallow (_ : OIDCUserModel | None = None ) -> bool :
626+ async def disallow (_ : OIDCUserModel | None = None ) -> bool :
613627 return False
614628
615629 @workflow ("unauthorized_workflow" , target = Target .CREATE , authorize_callback = disallow )
@@ -623,10 +637,10 @@ def unauthorized_workflow():
623637
624638@pytest .fixture
625639def authorize_resume_workflow ():
626- def disallow (_ : OIDCUserModel | None = None ) -> bool :
640+ async def disallow (_ : OIDCUserModel | None = None ) -> bool :
627641 return False
628642
629- def allow (_ : OIDCUserModel | None = None ) -> bool :
643+ async def allow (_ : OIDCUserModel | None = None ) -> bool :
630644 return True
631645
632646 class ConfirmForm (FormPage ):
@@ -719,19 +733,19 @@ def test_unauthorized_resume_input_step(test_client, process_on_unauthorized_res
719733 assert HTTPStatus .FORBIDDEN == response .status_code
720734
721735
722- def _A (_ : OIDCUserModel ) -> bool :
736+ async def _A (_ : OIDCUserModel ) -> bool :
723737 return True
724738
725739
726- def _B (_ : OIDCUserModel ) -> bool :
740+ async def _B (_ : OIDCUserModel ) -> bool :
727741 return True
728742
729743
730- def _C (_ : OIDCUserModel ) -> bool :
744+ async def _C (_ : OIDCUserModel ) -> bool :
731745 return True
732746
733747
734- def _D (_ : OIDCUserModel ) -> bool :
748+ async def _D (_ : OIDCUserModel ) -> bool :
735749 return True
736750
737751
@@ -844,10 +858,10 @@ def test_continue_awaiting_process_endpoint_wrong_process_status(test_client, pr
844858
845859@pytest .fixture
846860def authorize_step_group_retry_workflow ():
847- def disallow (_ : OIDCUserModel | None = None ) -> bool :
861+ async def disallow (_ : OIDCUserModel | None = None ) -> bool :
848862 return False
849863
850- def allow (_ : OIDCUserModel | None = None ) -> bool :
864+ async def allow (_ : OIDCUserModel | None = None ) -> bool :
851865 return True
852866
853867 steps = StepList ([])
@@ -919,10 +933,10 @@ def test_unauthorized_step_group_retry(test_client, process_on_unretriable_step_
919933
920934@pytest .fixture
921935def authorize_step_retry_workflow ():
922- def disallow (_ : OIDCUserModel | None = None ) -> bool :
936+ async def disallow (_ : OIDCUserModel | None = None ) -> bool :
923937 return False
924938
925- def allow (_ : OIDCUserModel | None = None ) -> bool :
939+ async def allow (_ : OIDCUserModel | None = None ) -> bool :
926940 return True
927941
928942 @step ("authorized_retry" , retry_auth_callback = allow )
@@ -998,10 +1012,10 @@ def test_unauthorized_step_retry(test_client, process_on_unretriable_step):
9981012
9991013@pytest .fixture
10001014def authorize_retrystep_retry_workflow ():
1001- def disallow (_ : OIDCUserModel | None = None ) -> bool :
1015+ async def disallow (_ : OIDCUserModel | None = None ) -> bool :
10021016 return False
10031017
1004- def allow (_ : OIDCUserModel | None = None ) -> bool :
1018+ async def allow (_ : OIDCUserModel | None = None ) -> bool :
10051019 return True
10061020
10071021 @retrystep ("authorized_retry" , retry_auth_callback = allow )
0 commit comments