def bedrockhook_run_side_effect(endpoint, *_args, **_kwargs): resp = PropertyMock() if endpoint == RunPipelineOperator.RUN_PIPELINE_PATH.format( pipeline_id): resp.content = '{{"id": "{}"}}'.format(run_id) elif endpoint == RunPipelineOperator.GET_PIPELINE_RUN_PATH.format( pipeline_id, run_id): resp.status_code = 200 resp.content = '{{"status": "{}"}}'.format(fail_status) elif endpoint == RunPipelineOperator.STOP_PIPELINE_RUN_PATH.format( run_id): resp.content = "OK" else: pytest.fail("Called with bad args: {}".format(endpoint)) return resp
def bedrockhook_run_side_effect(endpoint, *_args, **_kwargs): resp = PropertyMock() if endpoint == RunPipelineOperator.RUN_PIPELINE_PATH.format( pipeline_id): resp.content = '{{"id": "{}"}}'.format(run_id) elif endpoint == RunPipelineOperator.GET_PIPELINE_RUN_PATH.format( pipeline_id, run_id): resp.status_code = 200 if not _outer["has_waited"]: resp.content = '{{"status": "{}"}}'.format( RunPipelineOperator.WAIT_STATUS[0]) _outer["has_waited"] = True else: resp.content = '{{"status": "{}"}}'.format( RunPipelineOperator.SUCCESS_STATUS[0]) elif endpoint == RunPipelineOperator.STOP_PIPELINE_RUN_PATH.format( run_id): resp.content = "OK" else: pytest.fail("Called with bad args") return resp