Skip to content

Commit

Permalink
adds unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tdstein committed Sep 18, 2024
1 parent 2086bf8 commit 5b7b775
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/posit/connect/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,45 @@ def test_params_include_none(self):
assert mock_get.call_count == 1


class TestContentsFindBy:
@responses.activate
def test(self):
# behavior
mock_get = responses.get(
"https://connect.example/__api__/v1/content",
json=load_mock("v1/content.json"),
)

# setup
client = Client("https://connect.example", "12345")

# invoke
content = client.content.find_by(name="team-admin-dashboard")

# assert
assert mock_get.call_count == 1
assert content
assert content.name == "team-admin-dashboard"

@responses.activate
def test_miss(self):
# behavior
mock_get = responses.get(
"https://connect.example/__api__/v1/content",
json=load_mock("v1/content.json"),
)

# setup
client = Client("https://connect.example", "12345")

# invoke
content = client.content.find_by(name="does-not-exist")

# assert
assert mock_get.call_count == 1
assert content is None


class TestContentsFindOne:
@responses.activate
def test(self):
Expand Down

0 comments on commit 5b7b775

Please sign in to comment.