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

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")