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
859 B

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. from mock import Mock, patch
  2. from hc.payments.models import Subscription
  3. from hc.test import BaseTestCase
  4. class BillingHistoryTestCase(BaseTestCase):
  5. def setUp(self):
  6. super(BillingHistoryTestCase, self).setUp()
  7. self.sub = Subscription(user=self.alice)
  8. self.sub.subscription_id = "test-id"
  9. self.sub.customer_id = "test-customer-id"
  10. self.sub.save()
  11. @patch("hc.payments.models.braintree")
  12. def test_it_works(self, mock_braintree):
  13. m1 = Mock(id="abc123", amount=123)
  14. m2 = Mock(id="def456", amount=456)
  15. mock_braintree.Transaction.search.return_value = [m1, m2]
  16. self.client.login(username="[email protected]", password="password")
  17. r = self.client.get("/accounts/profile/billing/history/")
  18. self.assertContains(r, "123")
  19. self.assertContains(r, "def456")