forked from uncloud/uncloud
Adapt uncloud_pay tests to support billing addresses
This commit is contained in:
parent
e6eba7542b
commit
9bbe3b3b56
1 changed files with 19 additions and 4 deletions
|
@ -10,6 +10,11 @@ class BillingTestCase(TestCase):
|
|||
self.user = get_user_model().objects.create(
|
||||
username='jdoe',
|
||||
email='john.doe@domain.tld')
|
||||
self.billing_address = BillingAddress.objects.create(
|
||||
owner=self.user,
|
||||
street="unknown",
|
||||
city="unknown",
|
||||
postal_code="unknown")
|
||||
|
||||
def test_basic_monthly_billing(self):
|
||||
one_time_price = 10
|
||||
|
@ -25,7 +30,8 @@ class BillingTestCase(TestCase):
|
|||
owner=self.user,
|
||||
starting_date=starting_date,
|
||||
ending_date=ending_date,
|
||||
recurring_period=RecurringPeriod.PER_MONTH)
|
||||
recurring_period=RecurringPeriod.PER_MONTH,
|
||||
billing_address=self.billing_address)
|
||||
order.add_record(one_time_price, recurring_price, description)
|
||||
|
||||
# Generate & check bill for first month: full recurring_price + setup.
|
||||
|
@ -59,7 +65,8 @@ class BillingTestCase(TestCase):
|
|||
order = Order.objects.create(
|
||||
owner=self.user,
|
||||
starting_date=starting_date,
|
||||
recurring_period=RecurringPeriod.PER_YEAR)
|
||||
recurring_period=RecurringPeriod.PER_YEAR,
|
||||
billing_address=self.billing_address)
|
||||
order.add_record(one_time_price, recurring_price, description)
|
||||
|
||||
# Generate & check bill for first year: recurring_price + setup.
|
||||
|
@ -100,7 +107,8 @@ class BillingTestCase(TestCase):
|
|||
owner=self.user,
|
||||
starting_date=starting_date,
|
||||
ending_date=ending_date,
|
||||
recurring_period=RecurringPeriod.PER_HOUR)
|
||||
recurring_period=RecurringPeriod.PER_HOUR,
|
||||
billing_address=self.billing_address)
|
||||
order.add_record(one_time_price, recurring_price, description)
|
||||
|
||||
# Generate & check bill for first month: recurring_price + setup.
|
||||
|
@ -121,13 +129,20 @@ class ProductActivationTestCase(TestCase):
|
|||
username='jdoe',
|
||||
email='john.doe@domain.tld')
|
||||
|
||||
self.billing_address = BillingAddress.objects.create(
|
||||
owner=self.user,
|
||||
street="unknown",
|
||||
city="unknown",
|
||||
postal_code="unknown")
|
||||
|
||||
def test_product_activation(self):
|
||||
starting_date = datetime.fromisoformat('2020-03-01')
|
||||
|
||||
order = Order.objects.create(
|
||||
owner=self.user,
|
||||
starting_date=starting_date,
|
||||
recurring_period=RecurringPeriod.PER_MONTH)
|
||||
recurring_period=RecurringPeriod.PER_MONTH,
|
||||
billing_address=self.billing_address)
|
||||
order.save()
|
||||
|
||||
product = GenericServiceProduct(
|
||||
|
|
Loading…
Reference in a new issue