From dc1760b12c3abdf4a48763178927e716f0320e4f Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 16 Mar 2020 20:12:55 +0100 Subject: [PATCH] patch _get_docker_client in testfiles --- dockertidy/tests/unit/test_autostop.py | 8 +++++++- dockertidy/tests/unit/test_garbagecollector.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dockertidy/tests/unit/test_autostop.py b/dockertidy/tests/unit/test_autostop.py index 51ef67f..8b76fdf 100644 --- a/dockertidy/tests/unit/test_autostop.py +++ b/dockertidy/tests/unit/test_autostop.py @@ -11,7 +11,13 @@ pytest_plugins = [ @pytest.fixture -def autostop(): +def autostop(mocker): + mocker.patch.object( + Autostop.AutoStop, + "_get_docker_client", + return_value=mocker.create_autospec(docker.APIClient) + ) + stop = Autostop.AutoStop() return stop diff --git a/dockertidy/tests/unit/test_garbagecollector.py b/dockertidy/tests/unit/test_garbagecollector.py index 7d2ec97..9f48f87 100644 --- a/dockertidy/tests/unit/test_garbagecollector.py +++ b/dockertidy/tests/unit/test_garbagecollector.py @@ -12,7 +12,13 @@ pytest_plugins = [ @pytest.fixture -def gc(): +def gc(mocker): + mocker.patch.object( + GarbageCollector.GarbageCollector, + "_get_docker_client", + return_value=mocker.create_autospec(docker.APIClient) + ) + gc = GarbageCollector.GarbageCollector() return gc