diff --git a/hc/payments/tests/test_pricing.py b/hc/payments/tests/test_pricing.py index 57ee9745..7a695ea4 100644 --- a/hc/payments/tests/test_pricing.py +++ b/hc/payments/tests/test_pricing.py @@ -17,5 +17,5 @@ class PricingTestCase(BaseTestCase): r = self.client.get("/pricing/") self.assertContains(r, "Unlimited Checks", status_code=200) - # A subscription object should have been created - assert Subscription.objects.count() == 1 + # A subscription object still should have NOT been created + assert Subscription.objects.count() == 0 diff --git a/hc/payments/views.py b/hc/payments/views.py index 9316115e..0f6765af 100644 --- a/hc/payments/views.py +++ b/hc/payments/views.py @@ -30,7 +30,9 @@ def get_client_token(request): def pricing(request): sub = None if request.user.is_authenticated(): - sub = Subscription.objects.for_user(request.user) + # Don't use Subscription.objects.for_user method here, so a + # subscription object is not created just by viewing a page. + sub = Subscription.objects.filter(user_id=request.user.id).first() ctx = { "page": "pricing",