From 86775af4c88d0342ee5a24b9ff941e5b88d0ba77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Sat, 18 Apr 2020 09:02:33 +0200 Subject: [PATCH] Fix product activation tests after rebase --- uncloud_django_based/uncloud/uncloud_pay/models.py | 2 +- uncloud_django_based/uncloud/uncloud_pay/tests.py | 4 ++-- uncloud_django_based/uncloud/uncloud_service/models.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/uncloud_django_based/uncloud/uncloud_pay/models.py b/uncloud_django_based/uncloud/uncloud_pay/models.py index b213c35..4cb1952 100644 --- a/uncloud_django_based/uncloud/uncloud_pay/models.py +++ b/uncloud_django_based/uncloud/uncloud_pay/models.py @@ -579,7 +579,7 @@ class Product(UncloudModel): if being_created: record = OrderRecord( one_time_price=self.one_time_price, - recurring_price=self.recurring_price(self.recurring_period), + recurring_price=self.recurring_price(recurring_period=self.recurring_period), description=self.description) self.order.orderrecord_set.add(record, bulk=False) diff --git a/uncloud_django_based/uncloud/uncloud_pay/tests.py b/uncloud_django_based/uncloud/uncloud_pay/tests.py index 4bdd791..9e8728d 100644 --- a/uncloud_django_based/uncloud/uncloud_pay/tests.py +++ b/uncloud_django_based/uncloud/uncloud_pay/tests.py @@ -3,7 +3,7 @@ from django.contrib.auth import get_user_model from datetime import datetime, date, timedelta from .models import * -from ungleich_service.models import GenericServiceProduct +from uncloud_service.models import GenericServiceProduct class BillingTestCase(TestCase): def setUp(self): @@ -139,7 +139,7 @@ class ProductActivationTestCase(TestCase): product.save() # XXX: to be automated. - order.add_record(product.one_time_price, product.recurring_price, product.description) + order.add_record(product.one_time_price, product.recurring_price(), product.description) # Validate initial state: must be awaiting payment. self.assertEqual(product.status, UncloudStatus.AWAITING_PAYMENT) diff --git a/uncloud_django_based/uncloud/uncloud_service/models.py b/uncloud_django_based/uncloud/uncloud_service/models.py index fc92157..26bedfd 100644 --- a/uncloud_django_based/uncloud/uncloud_service/models.py +++ b/uncloud_django_based/uncloud/uncloud_service/models.py @@ -17,7 +17,7 @@ class MatrixServiceProduct(Product): domain = models.CharField(max_length=255, default='domain.tld') # Default recurring price is PER_MONT, see Product class. - def recurring_price(self): + def recurring_price(self, recurring_period=RecurringPeriod.PER_MONTH): return self.monthly_managment_fee @staticmethod @@ -46,8 +46,8 @@ class GenericServiceProduct(Product): decimal_places=AMOUNT_DECIMALS, validators=[MinValueValidator(0)]) - @property - def recurring_price(self): + def recurring_price(self, recurring_period=RecurringPeriod.PER_MONTH): + # FIXME: handle recurring_period somehow. return self.custom_recurring_price @property