Applied black formatter
This commit is contained in:
parent
577419798d
commit
9e2b47e82b
@ -825,7 +825,9 @@ class LambdaBackend(BaseBackend):
|
||||
return self._lambdas.publish_function(function_name)
|
||||
|
||||
def get_function(self, function_name_or_arn, qualifier=None):
|
||||
return self._lambdas.get_function_by_name_or_arn(function_name_or_arn, qualifier)
|
||||
return self._lambdas.get_function_by_name_or_arn(
|
||||
function_name_or_arn, qualifier
|
||||
)
|
||||
|
||||
def list_versions_by_function(self, function_name):
|
||||
return self._lambdas.list_versions_by_function(function_name)
|
||||
|
@ -388,7 +388,7 @@ def test_get_function():
|
||||
Timeout=3,
|
||||
MemorySize=128,
|
||||
Publish=True,
|
||||
Environment={"Variables": {"test_variable": "test_value"}}
|
||||
Environment={"Variables": {"test_variable": "test_value"}},
|
||||
)
|
||||
|
||||
result = conn.get_function(FunctionName="testFunction")
|
||||
@ -417,9 +417,11 @@ def test_get_function():
|
||||
result["Configuration"]["Timeout"].should.equal(3)
|
||||
result["Configuration"]["Version"].should.equal("$LATEST")
|
||||
result["Configuration"].should.contain("VpcConfig")
|
||||
result['Configuration'].should.contain('Environment')
|
||||
result['Configuration']['Environment'].should.contain('Variables')
|
||||
result['Configuration']['Environment']["Variables"].should.equal({"test_variable": "test_value"})
|
||||
result["Configuration"].should.contain("Environment")
|
||||
result["Configuration"]["Environment"].should.contain("Variables")
|
||||
result["Configuration"]["Environment"]["Variables"].should.equal(
|
||||
{"test_variable": "test_value"}
|
||||
)
|
||||
|
||||
# Test get function with
|
||||
result = conn.get_function(FunctionName="testFunction", Qualifier="$LATEST")
|
||||
@ -432,26 +434,32 @@ def test_get_function():
|
||||
with assert_raises(ClientError):
|
||||
conn.get_function(FunctionName="junk", Qualifier="$LATEST")
|
||||
|
||||
|
||||
@mock_lambda
|
||||
@mock_s3
|
||||
def test_get_function_by_arn():
|
||||
bucket_name = 'test-bucket'
|
||||
s3_conn = boto3.client('s3', 'us-east-1')
|
||||
bucket_name = "test-bucket"
|
||||
s3_conn = boto3.client("s3", "us-east-1")
|
||||
s3_conn.create_bucket(Bucket=bucket_name)
|
||||
|
||||
zip_content = get_test_zip_file2()
|
||||
s3_conn.put_object(Bucket=bucket_name, Key='test.zip', Body=zip_content)
|
||||
conn = boto3.client('lambda', 'us-east-1')
|
||||
s3_conn.put_object(Bucket=bucket_name, Key="test.zip", Body=zip_content)
|
||||
conn = boto3.client("lambda", "us-east-1")
|
||||
|
||||
fnc = conn.create_function(FunctionName='testFunction',
|
||||
Runtime='python2.7', Role='test-iam-role',
|
||||
Handler='lambda_function.lambda_handler',
|
||||
Code={'S3Bucket': bucket_name, 'S3Key': 'test.zip'},
|
||||
Description='test lambda function',
|
||||
Timeout=3, MemorySize=128, Publish=True)
|
||||
fnc = conn.create_function(
|
||||
FunctionName="testFunction",
|
||||
Runtime="python2.7",
|
||||
Role="test-iam-role",
|
||||
Handler="lambda_function.lambda_handler",
|
||||
Code={"S3Bucket": bucket_name, "S3Key": "test.zip"},
|
||||
Description="test lambda function",
|
||||
Timeout=3,
|
||||
MemorySize=128,
|
||||
Publish=True,
|
||||
)
|
||||
|
||||
result = conn.get_function(FunctionName=fnc['FunctionArn'])
|
||||
result['Configuration']['FunctionName'].should.equal('testFunction')
|
||||
result = conn.get_function(FunctionName=fnc["FunctionArn"])
|
||||
result["Configuration"]["FunctionName"].should.equal("testFunction")
|
||||
|
||||
|
||||
@mock_lambda
|
||||
@ -1347,7 +1355,7 @@ def test_update_configuration():
|
||||
Timeout=3,
|
||||
MemorySize=128,
|
||||
Publish=True,
|
||||
Environment={'Variables': {"test_old_environment": "test_old_value"}}
|
||||
Environment={"Variables": {"test_old_environment": "test_old_value"}},
|
||||
)
|
||||
|
||||
assert fxn["Description"] == "test lambda function"
|
||||
@ -1362,7 +1370,7 @@ def test_update_configuration():
|
||||
Handler="lambda_function.new_lambda_handler",
|
||||
Runtime="python3.6",
|
||||
Timeout=7,
|
||||
Environment={"Variables": {"test_environment": "test_value"}}
|
||||
Environment={"Variables": {"test_environment": "test_value"}},
|
||||
)
|
||||
|
||||
assert updated_config["ResponseMetadata"]["HTTPStatusCode"] == 200
|
||||
@ -1371,7 +1379,9 @@ def test_update_configuration():
|
||||
assert updated_config["MemorySize"] == 128
|
||||
assert updated_config["Runtime"] == "python3.6"
|
||||
assert updated_config["Timeout"] == 7
|
||||
assert updated_config["Environment"]["Variables"] == {"test_environment": "test_value"}
|
||||
assert updated_config["Environment"]["Variables"] == {
|
||||
"test_environment": "test_value"
|
||||
}
|
||||
|
||||
|
||||
@mock_lambda
|
||||
|
Loading…
Reference in New Issue
Block a user