lambda list_versions_by_function return $LATEST version and published version
This commit is contained in:
parent
6628567cbc
commit
8f4c273095
4 changed files with 56 additions and 19 deletions
|
|
@ -282,7 +282,7 @@ def test_create_function_from_aws_bucket():
|
|||
result.pop('LastModified')
|
||||
result.should.equal({
|
||||
'FunctionName': 'testFunction',
|
||||
'FunctionArn': 'arn:aws:lambda:{}:123456789012:function:testFunction:$LATEST'.format(_lambda_region),
|
||||
'FunctionArn': 'arn:aws:lambda:{}:123456789012:function:testFunction'.format(_lambda_region),
|
||||
'Runtime': 'python2.7',
|
||||
'Role': 'test-iam-role',
|
||||
'Handler': 'lambda_function.lambda_handler',
|
||||
|
|
@ -291,7 +291,7 @@ def test_create_function_from_aws_bucket():
|
|||
'Description': 'test lambda function',
|
||||
'Timeout': 3,
|
||||
'MemorySize': 128,
|
||||
'Version': '$LATEST',
|
||||
'Version': '1',
|
||||
'VpcConfig': {
|
||||
"SecurityGroupIds": ["sg-123abc"],
|
||||
"SubnetIds": ["subnet-123abc"],
|
||||
|
|
@ -327,7 +327,7 @@ def test_create_function_from_zipfile():
|
|||
|
||||
result.should.equal({
|
||||
'FunctionName': 'testFunction',
|
||||
'FunctionArn': 'arn:aws:lambda:{}:123456789012:function:testFunction:$LATEST'.format(_lambda_region),
|
||||
'FunctionArn': 'arn:aws:lambda:{}:123456789012:function:testFunction'.format(_lambda_region),
|
||||
'Runtime': 'python2.7',
|
||||
'Role': 'test-iam-role',
|
||||
'Handler': 'lambda_function.lambda_handler',
|
||||
|
|
@ -336,7 +336,7 @@ def test_create_function_from_zipfile():
|
|||
'Timeout': 3,
|
||||
'MemorySize': 128,
|
||||
'CodeSha256': hashlib.sha256(zip_content).hexdigest(),
|
||||
'Version': '$LATEST',
|
||||
'Version': '1',
|
||||
'VpcConfig': {
|
||||
"SecurityGroupIds": [],
|
||||
"SubnetIds": [],
|
||||
|
|
@ -398,6 +398,8 @@ def test_get_function():
|
|||
# Test get function with
|
||||
result = conn.get_function(FunctionName='testFunction', Qualifier='$LATEST')
|
||||
result['Configuration']['Version'].should.equal('$LATEST')
|
||||
result['Configuration']['FunctionArn'].should.equal('arn:aws:lambda:us-west-2:123456789012:function:testFunction:$LATEST')
|
||||
|
||||
|
||||
# Test get function when can't find function name
|
||||
with assert_raises(ClientError):
|
||||
|
|
@ -464,7 +466,7 @@ def test_publish():
|
|||
Description='test lambda function',
|
||||
Timeout=3,
|
||||
MemorySize=128,
|
||||
Publish=True,
|
||||
Publish=False,
|
||||
)
|
||||
|
||||
function_list = conn.list_functions()
|
||||
|
|
@ -485,7 +487,7 @@ def test_publish():
|
|||
|
||||
function_list = conn.list_functions()
|
||||
function_list['Functions'].should.have.length_of(1)
|
||||
function_list['Functions'][0]['FunctionArn'].should.contain('testFunction:$LATEST')
|
||||
function_list['Functions'][0]['FunctionArn'].should.contain('testFunction')
|
||||
|
||||
|
||||
@mock_lambda
|
||||
|
|
@ -528,7 +530,7 @@ def test_list_create_list_get_delete_list():
|
|||
"CodeSha256": hashlib.sha256(zip_content).hexdigest(),
|
||||
"CodeSize": len(zip_content),
|
||||
"Description": "test lambda function",
|
||||
"FunctionArn": 'arn:aws:lambda:{}:123456789012:function:testFunction:$LATEST'.format(_lambda_region),
|
||||
"FunctionArn": 'arn:aws:lambda:{}:123456789012:function:testFunction'.format(_lambda_region),
|
||||
"FunctionName": "testFunction",
|
||||
"Handler": "lambda_function.lambda_handler",
|
||||
"MemorySize": 128,
|
||||
|
|
@ -701,7 +703,7 @@ def test_invoke_async_function():
|
|||
)
|
||||
|
||||
success_result = conn.invoke_async(
|
||||
FunctionName='testFunction',
|
||||
FunctionName='testFunction',
|
||||
InvokeArgs=json.dumps({'test': 'event'})
|
||||
)
|
||||
|
||||
|
|
@ -741,7 +743,7 @@ def test_get_function_created_with_zipfile():
|
|||
"CodeSha256": hashlib.sha256(zip_content).hexdigest(),
|
||||
"CodeSize": len(zip_content),
|
||||
"Description": "test lambda function",
|
||||
"FunctionArn": 'arn:aws:lambda:{}:123456789012:function:testFunction:$LATEST'.format(_lambda_region),
|
||||
"FunctionArn": 'arn:aws:lambda:{}:123456789012:function:testFunction'.format(_lambda_region),
|
||||
"FunctionName": "testFunction",
|
||||
"Handler": "lambda_function.handler",
|
||||
"MemorySize": 128,
|
||||
|
|
@ -842,7 +844,7 @@ def test_list_versions_by_function():
|
|||
conn.create_function(
|
||||
FunctionName='testFunction',
|
||||
Runtime='python2.7',
|
||||
Role='test-iam-role',
|
||||
Role='arn:aws:iam::123456789012:role/test-iam-role',
|
||||
Handler='lambda_function.lambda_handler',
|
||||
Code={
|
||||
'S3Bucket': 'test-bucket',
|
||||
|
|
@ -857,8 +859,28 @@ def test_list_versions_by_function():
|
|||
res = conn.publish_version(FunctionName='testFunction')
|
||||
assert res['ResponseMetadata']['HTTPStatusCode'] == 201
|
||||
versions = conn.list_versions_by_function(FunctionName='testFunction')
|
||||
|
||||
assert len(versions['Versions']) == 3
|
||||
assert versions['Versions'][0]['FunctionArn'] == 'arn:aws:lambda:us-west-2:123456789012:function:testFunction:$LATEST'
|
||||
assert versions['Versions'][1]['FunctionArn'] == 'arn:aws:lambda:us-west-2:123456789012:function:testFunction:1'
|
||||
assert versions['Versions'][2]['FunctionArn'] == 'arn:aws:lambda:us-west-2:123456789012:function:testFunction:2'
|
||||
|
||||
conn.create_function(
|
||||
FunctionName='testFunction_2',
|
||||
Runtime='python2.7',
|
||||
Role='arn:aws:iam::123456789012:role/test-iam-role',
|
||||
Handler='lambda_function.lambda_handler',
|
||||
Code={
|
||||
'S3Bucket': 'test-bucket',
|
||||
'S3Key': 'test.zip',
|
||||
},
|
||||
Description='test lambda function',
|
||||
Timeout=3,
|
||||
MemorySize=128,
|
||||
Publish=False,
|
||||
)
|
||||
versions = conn.list_versions_by_function(FunctionName='testFunction_2')
|
||||
assert len(versions['Versions']) == 1
|
||||
assert versions['Versions'][0]['FunctionArn'] == 'arn:aws:lambda:us-west-2:123456789012:function:testFunction_2:$LATEST'
|
||||
|
||||
|
||||
@mock_lambda
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue