|
|
- from mock import patch
-
- from hc.payments.models import Subscription
- from hc.test import BaseTestCase
-
-
- class UpdatePaymentMethodTestCase(BaseTestCase):
- @patch("hc.payments.models.braintree")
- def test_it_retrieves_paypal(self, mock):
- mock.paypal_account.PayPalAccount = dict
- mock.credit_card.CreditCard = list
- mock.PaymentMethod.find.return_value = {"email": "[email protected]"}
-
- Subscription.objects.create(user=self.alice)
-
- self.client.login(username="[email protected]", password="password")
- r = self.client.get("/accounts/profile/billing/payment_method/")
- self.assertContains(r, "[email protected]")
-
- @patch("hc.payments.models.braintree")
- def test_it_retrieves_cc(self, mock):
- mock.paypal_account.PayPalAccount = list
- mock.credit_card.CreditCard = dict
- mock.PaymentMethod.find.return_value = {"masked_number": "1***2"}
-
- Subscription.objects.create(user=self.alice)
-
- self.client.login(username="[email protected]", password="password")
- r = self.client.get("/accounts/profile/billing/payment_method/")
- self.assertContains(r, "1***2")
|