Fix linting
This commit is contained in:
parent
2ae09c5335
commit
ee8231202a
@ -172,9 +172,9 @@ class LambdaResponse(BaseResponse):
|
|||||||
function_name, qualifier, self.body, self.headers, response_headers
|
function_name, qualifier, self.body, self.headers, response_headers
|
||||||
)
|
)
|
||||||
if payload:
|
if payload:
|
||||||
if request.headers['X-Amz-Invocation-Type'] == 'Event':
|
if request.headers["X-Amz-Invocation-Type"] == "Event":
|
||||||
status_code = 202
|
status_code = 202
|
||||||
elif request.headers['X-Amz-Invocation-Type'] == 'DryRun':
|
elif request.headers["X-Amz-Invocation-Type"] == "DryRun":
|
||||||
status_code = 204
|
status_code = 204
|
||||||
else:
|
else:
|
||||||
status_code = 200
|
status_code = 200
|
||||||
|
@ -153,33 +153,31 @@ def test_invoke_event_function():
|
|||||||
|
|
||||||
@mock_lambda
|
@mock_lambda
|
||||||
def test_invoke_dryrun_function():
|
def test_invoke_dryrun_function():
|
||||||
conn = boto3.client('lambda', 'us-west-2')
|
conn = boto3.client("lambda", "us-west-2")
|
||||||
conn.create_function(
|
conn.create_function(
|
||||||
FunctionName='testFunction',
|
FunctionName="testFunction",
|
||||||
Runtime='python2.7',
|
Runtime="python2.7",
|
||||||
Role=get_role_name(),
|
Role=get_role_name(),
|
||||||
Handler='lambda_function.lambda_handler',
|
Handler="lambda_function.lambda_handler",
|
||||||
Code={
|
Code={"ZipFile": get_test_zip_file1(),},
|
||||||
'ZipFile': get_test_zip_file1(),
|
Description="test lambda function",
|
||||||
},
|
|
||||||
Description='test lambda function',
|
|
||||||
Timeout=3,
|
Timeout=3,
|
||||||
MemorySize=128,
|
MemorySize=128,
|
||||||
Publish=True,
|
Publish=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
conn.invoke.when.called_with(
|
conn.invoke.when.called_with(
|
||||||
FunctionName='notAFunction',
|
FunctionName="notAFunction", InvocationType="Event", Payload="{}"
|
||||||
InvocationType='Event',
|
|
||||||
Payload='{}'
|
|
||||||
).should.throw(botocore.client.ClientError)
|
).should.throw(botocore.client.ClientError)
|
||||||
|
|
||||||
in_data = {'msg': 'So long and thanks for all the fish'}
|
in_data = {"msg": "So long and thanks for all the fish"}
|
||||||
success_result = conn.invoke(
|
success_result = conn.invoke(
|
||||||
FunctionName='testFunction', InvocationType='DryRun', Payload=json.dumps(in_data))
|
FunctionName="testFunction",
|
||||||
|
InvocationType="DryRun",
|
||||||
|
Payload=json.dumps(in_data),
|
||||||
|
)
|
||||||
success_result["StatusCode"].should.equal(204)
|
success_result["StatusCode"].should.equal(204)
|
||||||
json.loads(success_result['Payload'].read().decode(
|
json.loads(success_result["Payload"].read().decode("utf-8")).should.equal({})
|
||||||
'utf-8')).should.equal({})
|
|
||||||
|
|
||||||
|
|
||||||
if settings.TEST_SERVER_MODE:
|
if settings.TEST_SERVER_MODE:
|
||||||
|
Loading…
Reference in New Issue
Block a user