You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

9 years ago
9 years ago
9 years ago
9 years ago
  1. from django.test import override_settings
  2. from hc.payments.models import Subscription
  3. from hc.test import BaseTestCase
  4. class PricingTestCase(BaseTestCase):
  5. def test_anonymous(self):
  6. r = self.client.get("/pricing/")
  7. self.assertContains(r, "Unlimited Checks", status_code=200)
  8. # A subscription object should have NOT been created
  9. assert Subscription.objects.count() == 0
  10. def test_authenticated(self):
  11. self.client.login(username="[email protected]", password="password")
  12. r = self.client.get("/pricing/")
  13. self.assertContains(r, "Unlimited Checks", status_code=200)
  14. # A subscription object still should have NOT been created
  15. assert Subscription.objects.count() == 0
  16. @override_settings(USE_PAYMENTS=True)
  17. def test_pricing_is_hidden_for_team_members(self):
  18. self.client.login(username="[email protected]", password="password")
  19. r = self.client.get("/about/")
  20. # Bob should not see pricing tab, as bob is currently on
  21. # Alice's team, but is not its owner.
  22. self.assertNotContains(r, "Pricing")
  23. @override_settings(USE_PAYMENTS=True)
  24. def test_pricing_is_visible_for_team_owners(self):
  25. self.client.login(username="[email protected]", password="password")
  26. r = self.client.get("/about/")
  27. self.assertContains(r, "Pricing")