IOT: update thing group descriptions (#5298)

This commit is contained in:
Jonas 2022-07-27 12:03:26 +02:00 committed by GitHub
parent 9d26ec7422
commit f47d9eefef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View File

@ -1311,6 +1311,10 @@ class IoTBackend(BaseBackend):
].update(attributes)
elif attribute_payload is not None and "attributes" not in attribute_payload:
thing_group.attributes = {}
if "thingGroupDescription" in thing_group_properties:
thing_group.thing_group_properties[
"thingGroupDescription"
] = thing_group_properties["thingGroupDescription"]
thing_group.version = thing_group.version + 1
return thing_group.version

View File

@ -594,3 +594,24 @@ def test_thing_group_already_exists_with_same_properties_returned():
thingGroupName=thing_group_name, thingGroupProperties=thing_group_properties
)
assert thing_group == current_thing_group
@mock_iot
def test_thing_group_updates_description():
client = boto3.client("iot", region_name="ap-northeast-1")
name = "my-thing-group"
new_description = "new description"
client.create_thing_group(
thingGroupName=name,
thingGroupProperties={"thingGroupDescription": "initial-description"},
)
client.update_thing_group(
thingGroupName=name,
thingGroupProperties={"thingGroupDescription": new_description},
)
thing_group = client.describe_thing_group(thingGroupName=name)
thing_group.should.have.key("thingGroupProperties").which.should.have.key(
"thingGroupDescription"
).which.should.equal(new_description)