diff --git a/uncloud_django_based/uncloud/uncloud_pay/tests.py b/uncloud_django_based/uncloud/uncloud_pay/tests.py index 9e8728d..5236c8a 100644 --- a/uncloud_django_based/uncloud/uncloud_pay/tests.py +++ b/uncloud_django_based/uncloud/uncloud_pay/tests.py @@ -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(