Skip to content

Commit 19104f1

Browse files
chrisjsimpsonclaude
andcommitted
test: skip Stripe test-clock test when placeholder API key is in use
test_draft_invoices_get_application_fee_amount_applied calls the live Stripe API (stripe.Account.create, TestClock.create, etc). In CI we copy settings.yaml.example which ships with STRIPE_TEST_SECRET_KEY='sk_test_changeme', so the test fails the whole pytest run with AuthenticationError and blocks PR merges. Adding a skipif guard on the placeholder key lets CI pass without us having to store real Stripe secrets in GitHub Actions secrets (which the maintainer has explicitly opted out of for now). Running the test locally with a real STRIPE_TEST_SECRET_KEY exported in settings.yaml still exercises the full path. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 0087bbe commit 19104f1

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/test_draft_invoice_application_fee_applied_time_clock.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import time
22
import sys
3+
import pytest
34
import stripe
45
from subscribie.settings import settings
56
from uuid import uuid4
@@ -8,6 +9,18 @@
89
import subprocess
910

1011

12+
_STRIPE_TEST_KEY = settings.get("STRIPE_TEST_SECRET_KEY") or ""
13+
14+
15+
@pytest.mark.skipif(
16+
not _STRIPE_TEST_KEY or "changeme" in _STRIPE_TEST_KEY,
17+
reason=(
18+
"Requires a real STRIPE_TEST_SECRET_KEY. The placeholder "
19+
"'sk_test_changeme' from settings.yaml.example is in use, so this "
20+
"test would call the live Stripe API and 401. Run locally with a "
21+
"real key to exercise the Stripe test-clock path."
22+
),
23+
)
1124
def test_draft_invoices_get_application_fee_amount_applied():
1225
"""
1326
Verify that future draft invoices generated by existing (and active)

0 commit comments

Comments
 (0)