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 eb70b5f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion integration/tests/posit/connect/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ def test_find(self):
def test_find_one(self):
assert self.client.content.find_one()

def test_content_item_owner(self):
def test_content_item_owner_without_in(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 eb70b5f

Please sign in to comment.