Fix product activation tests after rebase

This commit is contained in:
fnux 2020-04-18 09:02:33 +02:00
parent 83d2cd465d
commit 86775af4c8
3 changed files with 6 additions and 6 deletions

View File

@ -579,7 +579,7 @@ class Product(UncloudModel):
if being_created: if being_created:
record = OrderRecord( record = OrderRecord(
one_time_price=self.one_time_price, 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) description=self.description)
self.order.orderrecord_set.add(record, bulk=False) self.order.orderrecord_set.add(record, bulk=False)

View File

@ -3,7 +3,7 @@ from django.contrib.auth import get_user_model
from datetime import datetime, date, timedelta from datetime import datetime, date, timedelta
from .models import * from .models import *
from ungleich_service.models import GenericServiceProduct from uncloud_service.models import GenericServiceProduct
class BillingTestCase(TestCase): class BillingTestCase(TestCase):
def setUp(self): def setUp(self):
@ -139,7 +139,7 @@ class ProductActivationTestCase(TestCase):
product.save() product.save()
# XXX: to be automated. # 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. # Validate initial state: must be awaiting payment.
self.assertEqual(product.status, UncloudStatus.AWAITING_PAYMENT) self.assertEqual(product.status, UncloudStatus.AWAITING_PAYMENT)

View File

@ -17,7 +17,7 @@ class MatrixServiceProduct(Product):
domain = models.CharField(max_length=255, default='domain.tld') domain = models.CharField(max_length=255, default='domain.tld')
# Default recurring price is PER_MONT, see Product class. # 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 return self.monthly_managment_fee
@staticmethod @staticmethod
@ -46,8 +46,8 @@ class GenericServiceProduct(Product):
decimal_places=AMOUNT_DECIMALS, decimal_places=AMOUNT_DECIMALS,
validators=[MinValueValidator(0)]) validators=[MinValueValidator(0)])
@property def recurring_price(self, recurring_period=RecurringPeriod.PER_MONTH):
def recurring_price(self): # FIXME: handle recurring_period somehow.
return self.custom_recurring_price return self.custom_recurring_price
@property @property