From 2d37ed2d94d002a3421f71ee4caea17de039fc7c Mon Sep 17 00:00:00 2001 From: benoit Date: Fri, 13 Aug 2021 10:59:44 +0200 Subject: [PATCH] Fix mock --- test/tools.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/tools.py b/test/tools.py index 8bef76b..b7c3a5d 100644 --- a/test/tools.py +++ b/test/tools.py @@ -9,6 +9,9 @@ here = pathlib.Path(__file__).parent def getjson(name: str) -> bytes: path = here / "json" / f"{name}.json" + if not path.exists(): + raise Exception(f"path doesnt exist : {path}") + with path.open() as f: return f.read().encode("utf-8") @@ -23,4 +26,5 @@ def my_mock(mocker: MockerFixture, json_file: str, status: int) -> None: def mock_rest_api(self: PatroniResource, service: str) -> MockApiReturnCode: return MockApiReturnCode(getjson(json_file), status) + mocker.resetall() mocker.patch("check_patroni.types.PatroniResource.rest_api", mock_rest_api)