Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amakarudze committed May 21, 2024
1 parent ae7b855 commit 94f5dd0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/donations/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,24 @@
STRIPE_SECRET_KEY = os.environ.get("STRIPE_SECRET_KEY", "test_public")


def test_index_no_stripe_keys(client):
def test_index(client):
resp = client.get(reverse("donations:index"))
assert resp.status_code == 200


def test_donate_no_stripe_keys(client):
with override_settings(STRIPE_PUBLIC_KEY=None, STRIPE_SECRET_KEY=None):
# Access donations
resp = client.get(reverse("donations:index"))
resp = client.get(reverse("donations:donate"))
assert resp.status_code == 200

# Check if it returns a list of past and future events
assert "form" and "STRIPE_PUBLIC_KEY" not in resp.context


def test_index(client):
def test_donate(client):
with override_settings(STRIPE_PUBLIC_KEY=STRIPE_PUBLIC_KEY, STRIPE_SECRET_KEY=STRIPE_SECRET_KEY):
resp = client.get(reverse("donations:index"))
resp = client.get(reverse("donations:donate"))
assert resp.status_code == 200

# Check if it returns a list of past and future events
Expand Down

0 comments on commit 94f5dd0

Please sign in to comment.