forked from GithubBackups/healthchecks
Don't throw an exception if user's current project is unset.
This commit is contained in:
parent
accdfb637b
commit
ca5e19fd2d
@ -35,6 +35,15 @@ class PricingTestCase(BaseTestCase):
|
|||||||
r = self.client.get("/pricing/")
|
r = self.client.get("/pricing/")
|
||||||
self.assertContains(r, "To manage billing for this project")
|
self.assertContains(r, "To manage billing for this project")
|
||||||
|
|
||||||
|
def test_it_handles_null_project(self):
|
||||||
|
self.profile.current_project = None
|
||||||
|
self.profile.save()
|
||||||
|
|
||||||
|
self.client.login(username="alice@example.org", password="password")
|
||||||
|
|
||||||
|
r = self.client.get("/pricing/")
|
||||||
|
self.assertContains(r, "Unlimited Team Members")
|
||||||
|
|
||||||
def test_it_shows_active_plan(self):
|
def test_it_shows_active_plan(self):
|
||||||
self.sub = Subscription(user=self.alice)
|
self.sub = Subscription(user=self.alice)
|
||||||
self.sub.subscription_id = "test-id"
|
self.sub.subscription_id = "test-id"
|
||||||
|
@ -16,9 +16,10 @@ def token(request):
|
|||||||
|
|
||||||
|
|
||||||
def pricing(request):
|
def pricing(request):
|
||||||
if request.user.is_authenticated and request.user != request.project.owner:
|
if request.user.is_authenticated:
|
||||||
ctx = {"page": "pricing"}
|
if request.project and request.project.owner != request.user:
|
||||||
return render(request, "payments/pricing_not_owner.html", ctx)
|
ctx = {"page": "pricing"}
|
||||||
|
return render(request, "payments/pricing_not_owner.html", ctx)
|
||||||
|
|
||||||
# Don't use Subscription.objects.for_user method here, so a
|
# Don't use Subscription.objects.for_user method here, so a
|
||||||
# subscription object is not created just by viewing a page.
|
# subscription object is not created just by viewing a page.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user