Fix pricing link for logged in users.

This commit is contained in:
Pēteris Caune 2016-05-14 16:35:43 +03:00
parent 813c316888
commit 0cf4c13f00
2 changed files with 7 additions and 1 deletions

View File

@ -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}

View File

@ -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")