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.

30 lines
1.1 KiB

  1. from mock import patch
  2. from hc.payments.models import Subscription
  3. from hc.test import BaseTestCase
  4. class UpdatePaymentMethodTestCase(BaseTestCase):
  5. @patch("hc.payments.models.braintree")
  6. def test_it_retrieves_paypal(self, mock):
  7. mock.paypal_account.PayPalAccount = dict
  8. mock.credit_card.CreditCard = list
  9. mock.PaymentMethod.find.return_value = {"email": "[email protected]"}
  10. Subscription.objects.create(user=self.alice)
  11. self.client.login(username="[email protected]", password="password")
  12. r = self.client.get("/accounts/profile/billing/payment_method/")
  13. self.assertContains(r, "[email protected]")
  14. @patch("hc.payments.models.braintree")
  15. def test_it_retrieves_cc(self, mock):
  16. mock.paypal_account.PayPalAccount = list
  17. mock.credit_card.CreditCard = dict
  18. mock.PaymentMethod.find.return_value = {"masked_number": "1***2"}
  19. Subscription.objects.create(user=self.alice)
  20. self.client.login(username="[email protected]", password="password")
  21. r = self.client.get("/accounts/profile/billing/payment_method/")
  22. self.assertContains(r, "1***2")