Updating for products/recurring periods

This commit is contained in:
Nico Schottelius 2020-10-06 18:53:13 +02:00
commit 9623a77907
7 changed files with 232 additions and 58 deletions

View file

@ -66,7 +66,6 @@ vm_order_upgrade_config = {
}
class ProductTestCase(TestCase):
"""
Test products and products <-> order interaction
@ -85,6 +84,9 @@ class ProductTestCase(TestCase):
postal_code="somewhere else",
active=True)
RecurringPeriod.populate_db_defaults()
self.default_recurring_period = RecurringPeriod.objects.get(name="Per 30 days")
def test_create_product(self):
"""
Create a sample product
@ -92,7 +94,8 @@ class ProductTestCase(TestCase):
p = Product.objects.create(name="Testproduct",
description="Only for testing",
config=vm_product_config)
config=vm_product_config,
default_recurring_period=self.default_recurring_period)
class OrderTestCase(TestCase):
@ -113,6 +116,10 @@ class OrderTestCase(TestCase):
postal_code="somewhere else",
active=True)
RecurringPeriod.populate_db_defaults()
self.default_recurring_period = RecurringPeriod.objects.get(name="Per 30 days")
def test_order_product(self):
"""
Order a product, ensure the order has correct price setup
@ -120,7 +127,8 @@ class OrderTestCase(TestCase):
p = Product.objects.create(name="Testproduct",
description="Only for testing",
config=vm_product_config)
config=vm_product_config,
default_recurring_period=self.default_recurring_period)
o = Order.objects.create(owner=self.user,
billing_address=self.ba,
@ -139,7 +147,8 @@ class OrderTestCase(TestCase):
p = Product.objects.create(name="Testproduct",
description="Only for testing",
config=vm_product_config)
config=vm_product_config,
default_recurring_period=self.default_recurring_period)
order1 = Order.objects.create(owner=self.user,
billing_address=self.ba,
@ -173,9 +182,13 @@ class ModifyOrderTestCase(TestCase):
postal_code="somewhere else",
active=True)
RecurringPeriod.populate_db_defaults()
self.default_recurring_period = RecurringPeriod.objects.get(name="Per 30 days")
self.product = Product.objects.create(name="Testproduct",
description="Only for testing",
config=vm_product_config)
config=vm_product_config,
default_recurring_period=self.default_recurring_period)
def test_change_order(self):