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.

33 lines
1.2 KiB

  1. from hc.payments.models import Subscription
  2. from hc.test import BaseTestCase
  3. class BillingCase(BaseTestCase):
  4. def test_it_disables_invoice_emailing(self):
  5. self.client.login(username="[email protected]", password="password")
  6. form = {"send_invoices": "0"}
  7. self.client.post("/accounts/profile/billing/", form)
  8. sub = Subscription.objects.get()
  9. self.assertFalse(sub.send_invoices)
  10. self.assertEqual(sub.invoice_email, "")
  11. def test_it_enables_invoice_emailing(self):
  12. self.client.login(username="[email protected]", password="password")
  13. form = {"send_invoices": "1"}
  14. self.client.post("/accounts/profile/billing/", form)
  15. sub = Subscription.objects.get()
  16. self.assertTrue(sub.send_invoices)
  17. self.assertEqual(sub.invoice_email, "")
  18. def test_it_saves_invoice_email(self):
  19. self.client.login(username="[email protected]", password="password")
  20. form = {"send_invoices": "2", "invoice_email": "[email protected]"}
  21. self.client.post("/accounts/profile/billing/", form)
  22. sub = Subscription.objects.get()
  23. self.assertTrue(sub.send_invoices)
  24. self.assertEqual(sub.invoice_email, "[email protected]")