ResourceGroup - Add Support for getGroupConfiguration (#3919)
* ResourceGroup - Add Support for getGroupConfiguration * Add tests * Add tests * Fix tests * linting * fix tests * fix tests * fix tests * fixed linting * fix tests
This commit is contained in:
parent
f9e0595e12
commit
eaac32b130
4 changed files with 114 additions and 4 deletions
|
|
@ -147,6 +147,75 @@ def test_update_group():
|
|||
response["Group"]["Description"].should.contain("description_2")
|
||||
|
||||
|
||||
@mock_resourcegroups
|
||||
def test_get_group_configuration():
|
||||
resource_groups = boto3.client("resource-groups", region_name="us-east-1")
|
||||
|
||||
group = test_get_group()
|
||||
|
||||
configuration = [
|
||||
{
|
||||
"Type": "AWS::ResourceGroups::Generic",
|
||||
"Parameters": [
|
||||
{"Name": "allowed-resource-types", "Values": ["AWS::EC2::Host"]},
|
||||
{"Name": "deletion-protection", "Values": ["UNLESS_EMPTY"]},
|
||||
],
|
||||
}
|
||||
]
|
||||
|
||||
resource_groups.put_group_configuration(
|
||||
Group=group["Group"]["Name"], Configuration=configuration
|
||||
)
|
||||
|
||||
configuration_resp = resource_groups.get_group_configuration(
|
||||
Group=group["Group"]["Name"]
|
||||
)
|
||||
|
||||
assert (
|
||||
configuration_resp.get("GroupConfiguration").get("Configuration")
|
||||
== configuration
|
||||
)
|
||||
|
||||
|
||||
@mock_resourcegroups
|
||||
def test_create_group_with_configuration():
|
||||
resource_groups = boto3.client("resource-groups", region_name="us-east-1")
|
||||
|
||||
configuration = [
|
||||
{
|
||||
"Type": "AWS::ResourceGroups::Generic",
|
||||
"Parameters": [
|
||||
{"Name": "allowed-resource-types", "Values": ["AWS::EC2::Host"]},
|
||||
{"Name": "deletion-protection", "Values": ["UNLESS_EMPTY"]},
|
||||
],
|
||||
}
|
||||
]
|
||||
response = resource_groups.create_group(
|
||||
Name="test_resource_group_new",
|
||||
Description="description",
|
||||
ResourceQuery={
|
||||
"Type": "TAG_FILTERS_1_0",
|
||||
"Query": json.dumps(
|
||||
{
|
||||
"ResourceTypeFilters": ["AWS::AllSupported"],
|
||||
"TagFilters": [
|
||||
{"Key": "resources_tag_key", "Values": ["resources_tag_value"]}
|
||||
],
|
||||
}
|
||||
),
|
||||
},
|
||||
Configuration=configuration,
|
||||
Tags={"resource_group_tag_key": "resource_group_tag_value"},
|
||||
)
|
||||
|
||||
response["Group"]["Name"].should.contain("test_resource_group_new")
|
||||
|
||||
assert response["GroupConfiguration"]["Configuration"] == configuration
|
||||
response["Tags"]["resource_group_tag_key"].should.contain(
|
||||
"resource_group_tag_value"
|
||||
)
|
||||
|
||||
|
||||
@mock_resourcegroups
|
||||
def test_update_group_query():
|
||||
resource_groups = boto3.client("resource-groups", region_name="us-east-1")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue