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.

25 lines
766 B

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. from mock import patch
  2. from hc.payments.models import Subscription
  3. from hc.test import BaseTestCase
  4. class CancelPlanTestCase(BaseTestCase):
  5. def setUp(self):
  6. super(CancelPlanTestCase, self).setUp()
  7. self.sub = Subscription(user=self.alice)
  8. self.sub.subscription_id = "test-id"
  9. self.sub.plan_id = "P5"
  10. self.sub.save()
  11. @patch("hc.payments.views.braintree")
  12. def test_it_works(self, mock_braintree):
  13. self.client.login(username="[email protected]", password="password")
  14. r = self.client.post("/pricing/cancel_plan/")
  15. self.assertRedirects(r, "/pricing/")
  16. self.sub.refresh_from_db()
  17. self.assertEqual(self.sub.subscription_id, "")
  18. self.assertEqual(self.sub.plan_id, "")