@pytest.fixture
def api_gw_method(request):
    'api gw for testing'
    marker = request.node.get_closest_marker('api_gw_method_args')
    put_method_args = marker.args[0]['put_method_args']
    put_method_response_args = marker.args[0]['put_method_response_args']
    api = None

    def fin():
        'fixture finalizer'
        if api:
            api_client.delete_rest_api(restApiId=api['id'])
    request.addfinalizer(fin)
    api_client = boto3.client('apigateway', endpoint_url=ENDPOINT_URL)
    api = api_client.create_rest_api(name='testapi')
    root_resource_id = api_client.get_resources(restApiId=api['id'])['items'][0]['id']
    api_resource = api_client.create_resource(restApiId=api['id'], parentId=root_resource_id, pathPart='test')
    api_client.put_method(restApiId=api['id'], resourceId=api_resource['id'], authorizationType='NONE', **put_method_args)
    api_client.put_method_response(restApiId=api['id'], resourceId=api_resource['id'], statusCode='200', **put_method_response_args)
    return (api_client, api, api_resource)
api gw for testing
@pytest.fixture
def api_gw_method(request):
    
    marker = request.node.get_closest_marker('api_gw_method_args')
    put_method_args = marker.args[0]['put_method_args']
    put_method_response_args = marker.args[0]['put_method_response_args']
    api = None

    def fin():
        'fixture finalizer'
        if api:
            api_client.delete_rest_api(restApiId=api['id'])
    request.addfinalizer(fin)
    api_client = boto3.client('apigateway', endpoint_url=ENDPOINT_URL)
    api = api_client.create_rest_api(name='testapi')
    root_resource_id = api_client.get_resources(restApiId=api['id'])['items'][0]['id']
    api_resource = api_client.create_resource(restApiId=api['id'], parentId=root_resource_id, pathPart='test')
    api_client.put_method(restApiId=api['id'], resourceId=api_resource['id'], authorizationType='NONE', **put_method_args)
    api_client.put_method_response(restApiId=api['id'], resourceId=api_resource['id'], statusCode='200', **put_method_response_args)
    return (api_client, api, api_resource)