From 71baa17bc27210d45faf538ece78ec252012c758 Mon Sep 17 00:00:00 2001 From: Kara Engelhardt Date: Mon, 8 Apr 2024 16:08:22 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Skip=20paypal=20tests=20if=20no=20p?= =?UTF-8?q?aypal=20secret=20in=20test=20settings=20set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fragdenstaat_de/fds_donation/tests/test_paypal.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fragdenstaat_de/fds_donation/tests/test_paypal.py b/fragdenstaat_de/fds_donation/tests/test_paypal.py index 970fac3c3..3e3fe1bde 100644 --- a/fragdenstaat_de/fds_donation/tests/test_paypal.py +++ b/fragdenstaat_de/fds_donation/tests/test_paypal.py @@ -28,7 +28,10 @@ def setup_webhook(self): process_args = [ "ssh", "-o", - "StrictHostKeyChecking=no", + "StrictHostKeyChecking=no", # Accept new hostkeys + "-o", + "UserKnownHostsFile=/dev/null", # Don't write new hostkeys to users known hosts file + "-q", # Quiet mode "-n", # Redirect stdin from /dev/null "-T", # Disable pseudo-tty allocation "-R", @@ -95,6 +98,14 @@ def __exit__(self, exc_type, exc_val, exc_tb): self.proc.stop() +@pytest.fixture(autouse=True) +def skip_paypal_if_no_key(request, settings): + if request.node.get_closest_marker("paypal"): + secret_key = settings.PAYMENT_VARIANTS["paypal"][1]["secret"] + if not secret_key: + pytest.skip("skipped paypal test because paypal secret is not set") + + @pytest.fixture def paypal_setup(settings, live_server, monkeypatch): """