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.

18 lines
613 B

  1. from mock import patch
  2. from hc.payments.models import Subscription
  3. from hc.test import BaseTestCase
  4. class GetClientTokenTestCase(BaseTestCase):
  5. @patch("hc.payments.models.braintree")
  6. def test_it_works(self, mock_braintree):
  7. mock_braintree.ClientToken.generate.return_value = "test-token"
  8. self.client.login(username="[email protected]", password="password")
  9. r = self.client.get("/pricing/get_client_token/")
  10. self.assertContains(r, "test-token", status_code=200)
  11. # A subscription object should have been created
  12. assert Subscription.objects.count() == 1