Skip to content

Commit e753556

Browse files
committed
Test content item properties
1 parent 523550a commit e753556

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

integration/tests/posit/connect/test_tags.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
from typing import TYPE_CHECKING
2-
31
from posit import connect
42

5-
if TYPE_CHECKING:
6-
from posit.connect.content import ContentItem
7-
83

9-
# add integration tests here!
104
class TestTags:
115
@classmethod
126
def setup_class(cls):
@@ -146,20 +140,22 @@ def test_tag_content_items(self):
146140
assert len(tagC.content_items.find()) == 3
147141

148142
# Make sure unique content items are found
149-
content_items_list: list[ContentItem] = []
150-
for tag in [tagA, *tagA.descendant_tags.find()]:
151-
content_items_list.extend(tag.content_items.find())
152-
# Get unique content_item guids
153-
content_item_guids = set[str]()
154-
for content_item in content_items_list:
155-
if content_item["guid"] not in content_item_guids:
156-
content_item_guids.add(content_item["guid"])
157-
158-
assert content_item_guids == {
143+
child_content_items = tagA.child_tags.content_items.find()
144+
assert len(child_content_items) == 2
145+
child_content_item_guids = [content_item["guid"] for content_item in child_content_items]
146+
assert child_content_item_guids == [self.contentB["guid"], self.contentC["guid"]]
147+
148+
descendant_content_items = tagA.descendant_tags.content_items.find()
149+
assert len(descendant_content_items) == 3
150+
151+
descendant_content_item_guids = [
152+
content_item["guid"] for content_item in descendant_content_items
153+
]
154+
assert descendant_content_item_guids == [
159155
self.contentA["guid"],
160156
self.contentB["guid"],
161157
self.contentC["guid"],
162-
}
158+
]
163159

164160
self.contentA.tags.delete(tagRoot)
165161
self.contentB.tags.delete(tagRoot)

0 commit comments

Comments
 (0)