Refactored test_describe_thing_group_metadata_hierarchy to use generate_thing_group_tree
This commit is contained in:
parent
0869c83ea5
commit
f7b0484428
@ -958,56 +958,14 @@ def test_describe_thing_group_metadata_hierarchy():
|
||||
group_name_3c = "my-group-name-3c"
|
||||
group_name_3d = "my-group-name-3d"
|
||||
|
||||
# --1a
|
||||
# |--2a
|
||||
# | |--3a
|
||||
# | |--3b
|
||||
# |
|
||||
# |--2b
|
||||
# |--3c
|
||||
# |--3d
|
||||
# --1b
|
||||
|
||||
# create thing groups tree
|
||||
# 1
|
||||
thing_group1a = client.create_thing_group(thingGroupName=group_name_1a)
|
||||
thing_group1a.should.have.key("thingGroupName").which.should.equal(group_name_1a)
|
||||
thing_group1a.should.have.key("thingGroupArn")
|
||||
thing_group1b = client.create_thing_group(thingGroupName=group_name_1b)
|
||||
thing_group1b.should.have.key("thingGroupName").which.should.equal(group_name_1b)
|
||||
thing_group1b.should.have.key("thingGroupArn")
|
||||
# 2
|
||||
thing_group2a = client.create_thing_group(
|
||||
thingGroupName=group_name_2a, parentGroupName=group_name_1a
|
||||
)
|
||||
thing_group2a.should.have.key("thingGroupName").which.should.equal(group_name_2a)
|
||||
thing_group2a.should.have.key("thingGroupArn")
|
||||
thing_group2b = client.create_thing_group(
|
||||
thingGroupName=group_name_2b, parentGroupName=group_name_1a
|
||||
)
|
||||
thing_group2b.should.have.key("thingGroupName").which.should.equal(group_name_2b)
|
||||
thing_group2b.should.have.key("thingGroupArn")
|
||||
# 3
|
||||
thing_group3a = client.create_thing_group(
|
||||
thingGroupName=group_name_3a, parentGroupName=group_name_2a
|
||||
)
|
||||
thing_group3a.should.have.key("thingGroupName").which.should.equal(group_name_3a)
|
||||
thing_group3a.should.have.key("thingGroupArn")
|
||||
thing_group3b = client.create_thing_group(
|
||||
thingGroupName=group_name_3b, parentGroupName=group_name_2a
|
||||
)
|
||||
thing_group3b.should.have.key("thingGroupName").which.should.equal(group_name_3b)
|
||||
thing_group3b.should.have.key("thingGroupArn")
|
||||
thing_group3c = client.create_thing_group(
|
||||
thingGroupName=group_name_3c, parentGroupName=group_name_2b
|
||||
)
|
||||
thing_group3c.should.have.key("thingGroupName").which.should.equal(group_name_3c)
|
||||
thing_group3c.should.have.key("thingGroupArn")
|
||||
thing_group3d = client.create_thing_group(
|
||||
thingGroupName=group_name_3d, parentGroupName=group_name_2b
|
||||
)
|
||||
thing_group3d.should.have.key("thingGroupName").which.should.equal(group_name_3d)
|
||||
thing_group3d.should.have.key("thingGroupArn")
|
||||
tree_dict = {
|
||||
group_name_1a: {
|
||||
group_name_2a: {group_name_3a: {}, group_name_3b: {}},
|
||||
group_name_2b: {group_name_3c: {}, group_name_3d: {}},
|
||||
},
|
||||
group_name_1b: {},
|
||||
}
|
||||
group_catalog = generate_thing_group_tree(client, tree_dict)
|
||||
|
||||
# describe groups
|
||||
# groups level 1
|
||||
@ -1059,7 +1017,7 @@ def test_describe_thing_group_metadata_hierarchy():
|
||||
].should.match(group_name_1a)
|
||||
thing_group_description2a["thingGroupMetadata"]["rootToParentThingGroups"][0][
|
||||
"groupArn"
|
||||
].should.match(thing_group1a["thingGroupArn"])
|
||||
].should.match(group_catalog[group_name_1a]["thingGroupArn"])
|
||||
thing_group_description2a.should.have.key("version")
|
||||
# 2b
|
||||
thing_group_description2b = client.describe_thing_group(
|
||||
@ -1085,7 +1043,7 @@ def test_describe_thing_group_metadata_hierarchy():
|
||||
].should.match(group_name_1a)
|
||||
thing_group_description2b["thingGroupMetadata"]["rootToParentThingGroups"][0][
|
||||
"groupArn"
|
||||
].should.match(thing_group1a["thingGroupArn"])
|
||||
].should.match(group_catalog[group_name_1a]["thingGroupArn"])
|
||||
thing_group_description2b.should.have.key("version")
|
||||
# groups level 3
|
||||
# 3a
|
||||
@ -1112,13 +1070,13 @@ def test_describe_thing_group_metadata_hierarchy():
|
||||
].should.match(group_name_1a)
|
||||
thing_group_description3a["thingGroupMetadata"]["rootToParentThingGroups"][0][
|
||||
"groupArn"
|
||||
].should.match(thing_group1a["thingGroupArn"])
|
||||
].should.match(group_catalog[group_name_1a]["thingGroupArn"])
|
||||
thing_group_description3a["thingGroupMetadata"]["rootToParentThingGroups"][1][
|
||||
"groupName"
|
||||
].should.match(group_name_2a)
|
||||
thing_group_description3a["thingGroupMetadata"]["rootToParentThingGroups"][1][
|
||||
"groupArn"
|
||||
].should.match(thing_group2a["thingGroupArn"])
|
||||
].should.match(group_catalog[group_name_2a]["thingGroupArn"])
|
||||
thing_group_description3a.should.have.key("version")
|
||||
# 3b
|
||||
thing_group_description3b = client.describe_thing_group(
|
||||
@ -1144,13 +1102,13 @@ def test_describe_thing_group_metadata_hierarchy():
|
||||
].should.match(group_name_1a)
|
||||
thing_group_description3b["thingGroupMetadata"]["rootToParentThingGroups"][0][
|
||||
"groupArn"
|
||||
].should.match(thing_group1a["thingGroupArn"])
|
||||
].should.match(group_catalog[group_name_1a]["thingGroupArn"])
|
||||
thing_group_description3b["thingGroupMetadata"]["rootToParentThingGroups"][1][
|
||||
"groupName"
|
||||
].should.match(group_name_2a)
|
||||
thing_group_description3b["thingGroupMetadata"]["rootToParentThingGroups"][1][
|
||||
"groupArn"
|
||||
].should.match(thing_group2a["thingGroupArn"])
|
||||
].should.match(group_catalog[group_name_2a]["thingGroupArn"])
|
||||
thing_group_description3b.should.have.key("version")
|
||||
# 3c
|
||||
thing_group_description3c = client.describe_thing_group(
|
||||
@ -1176,13 +1134,13 @@ def test_describe_thing_group_metadata_hierarchy():
|
||||
].should.match(group_name_1a)
|
||||
thing_group_description3c["thingGroupMetadata"]["rootToParentThingGroups"][0][
|
||||
"groupArn"
|
||||
].should.match(thing_group1a["thingGroupArn"])
|
||||
].should.match(group_catalog[group_name_1a]["thingGroupArn"])
|
||||
thing_group_description3c["thingGroupMetadata"]["rootToParentThingGroups"][1][
|
||||
"groupName"
|
||||
].should.match(group_name_2b)
|
||||
thing_group_description3c["thingGroupMetadata"]["rootToParentThingGroups"][1][
|
||||
"groupArn"
|
||||
].should.match(thing_group2b["thingGroupArn"])
|
||||
].should.match(group_catalog[group_name_2b]["thingGroupArn"])
|
||||
thing_group_description3c.should.have.key("version")
|
||||
# 3d
|
||||
thing_group_description3d = client.describe_thing_group(
|
||||
@ -1208,13 +1166,13 @@ def test_describe_thing_group_metadata_hierarchy():
|
||||
].should.match(group_name_1a)
|
||||
thing_group_description3d["thingGroupMetadata"]["rootToParentThingGroups"][0][
|
||||
"groupArn"
|
||||
].should.match(thing_group1a["thingGroupArn"])
|
||||
].should.match(group_catalog[group_name_1a]["thingGroupArn"])
|
||||
thing_group_description3d["thingGroupMetadata"]["rootToParentThingGroups"][1][
|
||||
"groupName"
|
||||
].should.match(group_name_2b)
|
||||
thing_group_description3d["thingGroupMetadata"]["rootToParentThingGroups"][1][
|
||||
"groupArn"
|
||||
].should.match(thing_group2b["thingGroupArn"])
|
||||
].should.match(group_catalog[group_name_2b]["thingGroupArn"])
|
||||
thing_group_description3d.should.have.key("version")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user