Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.

Commit

Permalink
make it more clear what each test tests for
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb15 committed Apr 2, 2020
1 parent 5a24a3e commit 6838870
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions test_ahealthchecks.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def test_get_endpoint_if_does_not_exist():

@responses.activate
def test_create_check():
responses.add(responses.GET, API_URL_BASE + "/channels/", json={"channels": []})
responses.add(
responses.POST, API_URL_BASE + "/checks/", json={"ping_url": "foo"},
)
Expand All @@ -58,17 +57,26 @@ def test_create_check():


@responses.activate
def test_create_check_with_creation_options():
def test_create_check_with_channel():
responses.add(
responses.GET,
API_URL_BASE + "/channels/",
json={"channels": [{"name": "slack", "id": "1"}]},
json={"channels": [{"name": "slack", "id": "112536"}]},
)
responses.add(
responses.POST, API_URL_BASE + "/checks/", json={"ping_url": "foo"},
)
endpoint = ahealthchecks.create_check(
"fah", {"channels": ["slack"], "tags": "fooTag"}
)
endpoint = ahealthchecks.create_check("fah", {"channels": ["slack"]})
assert "foo" == endpoint
assert "fooTag" in responses.calls[1].request.body
assert "112536" in responses.calls[1].request.body


@responses.activate
def test_default_creation_params_can_be_overridden():
ahealthchecks.default_creation_params["timeout"] = 5326
responses.add(
responses.POST, API_URL_BASE + "/checks/", json={"ping_url": "foo"},
)
ahealthchecks.create_check("fah", {"timeout": 142})
assert "5326" not in responses.calls[0].request.body
assert "142" in responses.calls[0].request.body

0 comments on commit 6838870

Please sign in to comment.