Allow lambda get function by arn and addded environment configuration
This commit is contained in:
parent
8f3116220c
commit
90a9235f4c
3 changed files with 39 additions and 9 deletions
|
|
@ -379,6 +379,7 @@ def test_get_function():
|
|||
Timeout=3,
|
||||
MemorySize=128,
|
||||
Publish=True,
|
||||
Environment={"Variables": {"test_variable": "test_value"}}
|
||||
)
|
||||
|
||||
result = conn.get_function(FunctionName='testFunction')
|
||||
|
|
@ -403,6 +404,9 @@ 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"})
|
||||
|
||||
# Test get function with
|
||||
result = conn.get_function(FunctionName='testFunction', Qualifier='$LATEST')
|
||||
|
|
@ -414,6 +418,27 @@ 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')
|
||||
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')
|
||||
|
||||
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')
|
||||
|
||||
|
||||
@mock_lambda
|
||||
@mock_s3
|
||||
|
|
@ -1346,6 +1371,7 @@ def test_update_configuration():
|
|||
Timeout=3,
|
||||
MemorySize=128,
|
||||
Publish=True,
|
||||
Environment={'Variables': {"test_old_environment": "test_old_value"}}
|
||||
)
|
||||
|
||||
assert fxn['Description'] == 'test lambda function'
|
||||
|
|
@ -1359,7 +1385,8 @@ def test_update_configuration():
|
|||
Description='updated test lambda function',
|
||||
Handler='lambda_function.new_lambda_handler',
|
||||
Runtime='python3.6',
|
||||
Timeout=7
|
||||
Timeout=7,
|
||||
Environment={'Variables': {"test_environment": "test_value"}}
|
||||
)
|
||||
|
||||
assert updated_config['ResponseMetadata']['HTTPStatusCode'] == 200
|
||||
|
|
@ -1368,6 +1395,7 @@ 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"}
|
||||
|
||||
|
||||
@mock_lambda
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue