From 0cf4c13f0023fc3d6b8c3d5e694b8a2e4388bd04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Sat, 14 May 2016 16:35:43 +0300 Subject: [PATCH] Fix pricing link for logged in users. --- hc/payments/context_processors.py | 2 +- hc/payments/tests/test_pricing.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hc/payments/context_processors.py b/hc/payments/context_processors.py index e9e67a1f..d093d25e 100644 --- a/hc/payments/context_processors.py +++ b/hc/payments/context_processors.py @@ -6,7 +6,7 @@ def payments(request): show_pricing = settings.USE_PAYMENTS if show_pricing and request.user.is_authenticated(): profile = request.user.profile - if profile.id != profile.current_team_id: + if profile.current_team_id and profile.current_team_id != profile.id: show_pricing = False return {'show_pricing': show_pricing} diff --git a/hc/payments/tests/test_pricing.py b/hc/payments/tests/test_pricing.py index 5d17dded..a776fc4c 100644 --- a/hc/payments/tests/test_pricing.py +++ b/hc/payments/tests/test_pricing.py @@ -27,3 +27,9 @@ class PricingTestCase(BaseTestCase): # Bob should not see pricing tab, as bob is currently on # Alice's team, but is not its owner. self.assertNotContains(r, "Pricing") + + def test_pricing_is_visible_for_team_owners(self): + self.client.login(username="alice@example.org", password="password") + + r = self.client.get("/about/") + self.assertContains(r, "Pricing")