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.

26 lines
911 B

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