billing: Add mock for cancel at period end subscriptions.

This commit is contained in:
Vishnu Ks 2018-07-26 19:40:07 +05:30 committed by Rishi Gupta
parent d89e07b8a7
commit fa7b98030b
2 changed files with 7 additions and 0 deletions

View File

@ -31,6 +31,7 @@ class Subscription:
created: int created: int
status: str status: str
canceled_at: int canceled_at: int
cancel_at_period_end: bool
@staticmethod @staticmethod
def create(customer: str, billing: str, items: List[Dict[str, Any]], def create(customer: str, billing: str, items: List[Dict[str, Any]],

View File

@ -35,6 +35,12 @@ def mock_customer_with_canceled_subscription(*args: Any, **kwargs: Any) -> strip
customer.subscriptions.data[0].canceled_at = 1532602160 customer.subscriptions.data[0].canceled_at = 1532602160
return customer return customer
def mock_customer_with_cancel_at_period_end_subscription(*args: Any, **kwargs: Any) -> stripe.Customer:
customer = mock_customer_with_active_subscription()
customer.subscriptions.data[0].canceled_at = 1532602243
customer.subscriptions.data[0].cancel_at_period_end = True
return customer
def mock_upcoming_invoice(*args: Any, **kwargs: Any) -> stripe.Invoice: def mock_upcoming_invoice(*args: Any, **kwargs: Any) -> stripe.Invoice:
return stripe.util.convert_to_stripe_object(fixture_data["upcoming_invoice"]) return stripe.util.convert_to_stripe_object(fixture_data["upcoming_invoice"])