Supporting tags in KMS (#2332)
The CreateKey API method accepts tags but does not return them.
This commit is contained in:
parent
5dbdff7ca7
commit
348dc54e6a
5 changed files with 71 additions and 21 deletions
|
|
@ -2,7 +2,11 @@ from __future__ import unicode_literals
|
|||
|
||||
import boto3
|
||||
import sure # noqa
|
||||
from moto import mock_resourcegroupstaggingapi, mock_s3, mock_ec2, mock_elbv2
|
||||
from moto import mock_ec2
|
||||
from moto import mock_elbv2
|
||||
from moto import mock_kms
|
||||
from moto import mock_resourcegroupstaggingapi
|
||||
from moto import mock_s3
|
||||
|
||||
|
||||
@mock_s3
|
||||
|
|
@ -225,10 +229,12 @@ def test_get_tag_values_ec2():
|
|||
|
||||
@mock_ec2
|
||||
@mock_elbv2
|
||||
@mock_kms
|
||||
@mock_resourcegroupstaggingapi
|
||||
def test_get_resources_elbv2():
|
||||
conn = boto3.client('elbv2', region_name='us-east-1')
|
||||
def test_get_many_resources():
|
||||
elbv2 = boto3.client('elbv2', region_name='us-east-1')
|
||||
ec2 = boto3.resource('ec2', region_name='us-east-1')
|
||||
kms = boto3.client('kms', region_name='us-east-1')
|
||||
|
||||
security_group = ec2.create_security_group(
|
||||
GroupName='a-security-group', Description='First One')
|
||||
|
|
@ -242,7 +248,7 @@ def test_get_resources_elbv2():
|
|||
CidrBlock='172.28.7.0/26',
|
||||
AvailabilityZone='us-east-1b')
|
||||
|
||||
conn.create_load_balancer(
|
||||
elbv2.create_load_balancer(
|
||||
Name='my-lb',
|
||||
Subnets=[subnet1.id, subnet2.id],
|
||||
SecurityGroups=[security_group.id],
|
||||
|
|
@ -259,13 +265,27 @@ def test_get_resources_elbv2():
|
|||
]
|
||||
)
|
||||
|
||||
conn.create_load_balancer(
|
||||
elbv2.create_load_balancer(
|
||||
Name='my-other-lb',
|
||||
Subnets=[subnet1.id, subnet2.id],
|
||||
SecurityGroups=[security_group.id],
|
||||
Scheme='internal',
|
||||
)
|
||||
|
||||
kms.create_key(
|
||||
KeyUsage='ENCRYPT_DECRYPT',
|
||||
Tags=[
|
||||
{
|
||||
'TagKey': 'key_name',
|
||||
'TagValue': 'a_value'
|
||||
},
|
||||
{
|
||||
'TagKey': 'key_2',
|
||||
'TagValue': 'val2'
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
rtapi = boto3.client('resourcegroupstaggingapi', region_name='us-east-1')
|
||||
|
||||
resp = rtapi.get_resources(ResourceTypeFilters=['elasticloadbalancer:loadbalancer'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue