Skip to content

Commit

Permalink
assert user endpoint called once
Browse files Browse the repository at this point in the history
  • Loading branch information
tdstein committed Jun 13, 2024
1 parent 78ccaf6 commit b6b358f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions integration/tests/posit/connect/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ def test_content_item_owner(self):
item = self.client.content.find_one(include=None)
owner = item.owner
assert owner.guid == self.client.me.guid

def test_content_item_owner_from_include(self):
item = self.client.content.find_one(include="owner")
owner = item.owner
assert owner.guid == self.client.me.guid
7 changes: 6 additions & 1 deletion tests/posit/connect/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_owner(self):
json=mock_content,
)

responses.get(
mock_user_get = responses.get(
f"https://connect.example/__api__/v1/users/20a79ce3-6e87-4522-9faf-be24228800a4",
json=load_mock(
f"v1/users/20a79ce3-6e87-4522-9faf-be24228800a4.json"
Expand All @@ -210,6 +210,11 @@ def test_owner(self):
owner = item.owner
assert owner.guid == "20a79ce3-6e87-4522-9faf-be24228800a4"

# load a second time, assert tha owner is loaded from cached result
owner = item.owner
assert owner.guid == "20a79ce3-6e87-4522-9faf-be24228800a4"
assert mock_user_get.call_count == 1


class TestContentItemDelete:
@responses.activate
Expand Down

0 comments on commit b6b358f

Please sign in to comment.