IOT: update thing group descriptions (#5298)
This commit is contained in:
parent
9d26ec7422
commit
f47d9eefef
@ -1311,6 +1311,10 @@ class IoTBackend(BaseBackend):
|
|||||||
].update(attributes)
|
].update(attributes)
|
||||||
elif attribute_payload is not None and "attributes" not in attribute_payload:
|
elif attribute_payload is not None and "attributes" not in attribute_payload:
|
||||||
thing_group.attributes = {}
|
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
|
thing_group.version = thing_group.version + 1
|
||||||
return thing_group.version
|
return thing_group.version
|
||||||
|
|
||||||
|
@ -594,3 +594,24 @@ def test_thing_group_already_exists_with_same_properties_returned():
|
|||||||
thingGroupName=thing_group_name, thingGroupProperties=thing_group_properties
|
thingGroupName=thing_group_name, thingGroupProperties=thing_group_properties
|
||||||
)
|
)
|
||||||
assert thing_group == current_thing_group
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user