コード例 #1
0
 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
コード例 #2
0
 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
コード例 #3
0
ファイル: test_auth.py プロジェクト: pppontusw/dl-nhltv
def test_verify_request_200_401():
    req = PropertyMock()
    req.status_code = 401
    with pytest.raises(AuthenticationFailed):
        verify_request_200(req)
コード例 #4
0
ファイル: test_auth.py プロジェクト: pppontusw/dl-nhltv
def test_verify_request_200_201():
    req = PropertyMock()
    req.status_code = 201
    with pytest.raises(RequestFailed):
        verify_request_200(req)