From e3da0caaa1379a45a5c7dad14f3e8cfd1026c752 Mon Sep 17 00:00:00 2001 From: Kara Engelhardt Date: Mon, 8 Apr 2024 16:07:58 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Skip=20stripe=20tests=20if=20no=20s?= =?UTF-8?q?tripe=20secret=20in=20test=20settings=20set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dev.nix | 4 +++- fragdenstaat_de/fds_donation/tests/test_stripe.py | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dev.nix b/dev.nix index 969dfd24c..9e9b64629 100644 --- a/dev.nix +++ b/dev.nix @@ -1,7 +1,7 @@ with import { }; let dontCheckPython = drv: drv.overridePythonAttrs (old: { doCheck = false; }); - pythonPackages = python39Packages; + pythonPackages = python310Packages; harfbuzz_self = harfbuzz.override { withCoreText = true; }; ld_packages = [ @@ -75,5 +75,7 @@ pkgs.mkShell { glib libcxx cmake + + stripe-cli ] ++ (lib.optional stdenv.isDarwin pkgs.darwin.apple_sdk.frameworks.CoreText); } diff --git a/fragdenstaat_de/fds_donation/tests/test_stripe.py b/fragdenstaat_de/fds_donation/tests/test_stripe.py index 8add5b9c0..53dda3b05 100644 --- a/fragdenstaat_de/fds_donation/tests/test_stripe.py +++ b/fragdenstaat_de/fds_donation/tests/test_stripe.py @@ -100,6 +100,14 @@ def make_webhook_events(self, log: str): return [WebhookEvent(*m.groups()) for m in self.WH_EVENT_RE.finditer(log)] +@pytest.fixture(autouse=True) +def skip_stripe_if_no_key(request, settings): + if request.node.get_closest_marker("stripe"): + secret_key = settings.PAYMENT_VARIANTS["sepa"][1]["secret_key"] + if not secret_key: + pytest.skip("skipped stripe test because stripe key is not set") + + @pytest.fixture def stripe_sepa_setup(settings, live_server, monkeypatch): settings.SITE_URL = live_server.url