Linting
This commit is contained in:
parent
1cda64e9a3
commit
d6875c25cc
@ -57,7 +57,7 @@ class Deployment(BaseModel, dict):
|
|||||||
|
|
||||||
class IntegrationResponse(BaseModel, dict):
|
class IntegrationResponse(BaseModel, dict):
|
||||||
def __init__(self, status_code, selection_pattern=None, response_templates=None):
|
def __init__(self, status_code, selection_pattern=None, response_templates=None):
|
||||||
if response_templates == None:
|
if response_templates is None:
|
||||||
response_templates = {"application/json": None}
|
response_templates = {"application/json": None}
|
||||||
self["responseTemplates"] = response_templates
|
self["responseTemplates"] = response_templates
|
||||||
self["statusCode"] = status_code
|
self["statusCode"] = status_code
|
||||||
@ -74,10 +74,14 @@ class Integration(BaseModel, dict):
|
|||||||
self["requestTemplates"] = request_templates
|
self["requestTemplates"] = request_templates
|
||||||
self["integrationResponses"] = {"200": IntegrationResponse(200)}
|
self["integrationResponses"] = {"200": IntegrationResponse(200)}
|
||||||
|
|
||||||
def create_integration_response(self, status_code, selection_pattern, response_templates):
|
def create_integration_response(
|
||||||
|
self, status_code, selection_pattern, response_templates
|
||||||
|
):
|
||||||
if response_templates == {}:
|
if response_templates == {}:
|
||||||
response_templates = None
|
response_templates = None
|
||||||
integration_response = IntegrationResponse(status_code, selection_pattern, response_templates)
|
integration_response = IntegrationResponse(
|
||||||
|
status_code, selection_pattern, response_templates
|
||||||
|
)
|
||||||
self["integrationResponses"][status_code] = integration_response
|
self["integrationResponses"][status_code] = integration_response
|
||||||
return integration_response
|
return integration_response
|
||||||
|
|
||||||
|
@ -1230,6 +1230,7 @@ def test_put_integration_response_requires_responseTemplate():
|
|||||||
responseTemplates={},
|
responseTemplates={},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock_apigateway
|
@mock_apigateway
|
||||||
def test_put_integration_response_with_response_template():
|
def test_put_integration_response_with_response_template():
|
||||||
client = boto3.client("apigateway", region_name="us-west-2")
|
client = boto3.client("apigateway", region_name="us-west-2")
|
||||||
@ -1268,9 +1269,9 @@ def test_put_integration_response_with_response_template():
|
|||||||
resourceId=root_id,
|
resourceId=root_id,
|
||||||
httpMethod="GET",
|
httpMethod="GET",
|
||||||
statusCode="200",
|
statusCode="200",
|
||||||
selectionPattern= "foobar",
|
selectionPattern="foobar",
|
||||||
responseTemplates={"application/json": json.dumps({"data":"test"})})
|
responseTemplates={"application/json": json.dumps({"data": "test"})},
|
||||||
|
)
|
||||||
|
|
||||||
response = client.get_integration_response(
|
response = client.get_integration_response(
|
||||||
restApiId=api_id, resourceId=root_id, httpMethod="GET", statusCode="200"
|
restApiId=api_id, resourceId=root_id, httpMethod="GET", statusCode="200"
|
||||||
@ -1284,10 +1285,11 @@ def test_put_integration_response_with_response_template():
|
|||||||
"statusCode": "200",
|
"statusCode": "200",
|
||||||
"selectionPattern": "foobar",
|
"selectionPattern": "foobar",
|
||||||
"ResponseMetadata": {"HTTPStatusCode": 200},
|
"ResponseMetadata": {"HTTPStatusCode": 200},
|
||||||
"responseTemplates": {"application/json": json.dumps({"data":"test"})},
|
"responseTemplates": {"application/json": json.dumps({"data": "test"})},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock_apigateway
|
@mock_apigateway
|
||||||
def test_put_integration_validation():
|
def test_put_integration_validation():
|
||||||
client = boto3.client("apigateway", region_name="us-west-2")
|
client = boto3.client("apigateway", region_name="us-west-2")
|
||||||
|
Loading…
Reference in New Issue
Block a user