Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Commit

Permalink
test: update fixture_clear_partner_records fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinaa committed Jul 22, 2022
1 parent 0f9761c commit 89450e7
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions test-engineering/contract-tests/client/tests/test_contile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@ def fixture_hosts(request) -> Dict[str, str]:


@pytest.fixture(name="clear_partner_records")
def fixture_clear_partner_records(hosts) -> Callable:
def fixture_clear_partner_records(hosts: Dict[str, str]) -> Callable:
"""Clear Contile request history on partner."""

partner_host = hosts["partner"]

def _clear_records():
r: Response = requests.request("DELETE", f"{partner_host}/records/")
def clear_partner_records():
r: Response = requests.delete(f"{partner_host}/records/")

error_message: str = (
f"Request status code was not as expected. Records may not have cleared "
f"after test run, details: '{r.text}'."
)

assert r.status_code == 204, error_message
if r.status_code != 200:
error_message: str = (
f"The Partner records may not have cleared after the test execution.\n"
f"Response details:\n"
f"Status Code: {r.status_code}\n"
f"Content: '{r.text}'"
)
raise Exception(error_message)

return _clear_records
return clear_partner_records


@pytest.fixture(scope="function", autouse=True)
Expand Down

0 comments on commit 89450e7

Please sign in to comment.