|
@@ -27,9 +27,12 @@ class ServiceTests(TestCase):
|
|
s = Service.objects.create(name='Foo', document=self.doc)
|
|
s = Service.objects.create(name='Foo', document=self.doc)
|
|
self.assertEqual(s.get_prices(), {
|
|
self.assertEqual(s.get_prices(), {
|
|
'total_recurring_price': 0,
|
|
'total_recurring_price': 0,
|
|
|
|
+ 'total_goods_value_share': 0,
|
|
'unit_recurring_price': 0,
|
|
'unit_recurring_price': 0,
|
|
'unit_goods_value_share': 0,
|
|
'unit_goods_value_share': 0,
|
|
- 'total_goods_value_share': 0,
|
|
|
|
|
|
+ 'unit_recurring_price': 0,
|
|
|
|
+ 'unit_consolidated_cost': 0,
|
|
|
|
+ 'unit_staggered_goods_share': 0,
|
|
})
|
|
})
|
|
|
|
|
|
def test_get_prices_w_costs(self):
|
|
def test_get_prices_w_costs(self):
|
|
@@ -43,6 +46,8 @@ class ServiceTests(TestCase):
|
|
'unit_recurring_price': 0,
|
|
'unit_recurring_price': 0,
|
|
'unit_goods_value_share': 0,
|
|
'unit_goods_value_share': 0,
|
|
'total_goods_value_share': 0,
|
|
'total_goods_value_share': 0,
|
|
|
|
+ 'unit_staggered_goods_share': 0.0,
|
|
|
|
+ 'unit_consolidated_cost': 0,
|
|
})
|
|
})
|
|
|
|
|
|
s.subscriptions_count = 2
|
|
s.subscriptions_count = 2
|
|
@@ -50,9 +55,11 @@ class ServiceTests(TestCase):
|
|
|
|
|
|
self.assertEqual(s.get_prices(), {
|
|
self.assertEqual(s.get_prices(), {
|
|
'total_recurring_price': 10,
|
|
'total_recurring_price': 10,
|
|
|
|
+ 'total_goods_value_share': 0,
|
|
'unit_recurring_price': 5,
|
|
'unit_recurring_price': 5,
|
|
'unit_goods_value_share': 0,
|
|
'unit_goods_value_share': 0,
|
|
- 'total_goods_value_share': 0,
|
|
|
|
|
|
+ 'unit_staggered_goods_share': 0,
|
|
|
|
+ 'unit_consolidated_cost': 5.0,
|
|
})
|
|
})
|
|
|
|
|
|
def test_get_prices_w_goods(self):
|
|
def test_get_prices_w_goods(self):
|
|
@@ -66,17 +73,22 @@ class ServiceTests(TestCase):
|
|
'total_recurring_price': 10/(365*3)*365.25/12,
|
|
'total_recurring_price': 10/(365*3)*365.25/12,
|
|
'unit_recurring_price': 0,
|
|
'unit_recurring_price': 0,
|
|
'unit_goods_value_share': 0,
|
|
'unit_goods_value_share': 0,
|
|
- 'total_goods_value_share': 10.0,
|
|
|
|
|
|
+ 'total_goods_value_share': 10,
|
|
|
|
+ 'unit_consolidated_cost': 0.0,
|
|
|
|
+ 'unit_staggered_goods_share': 0.0,
|
|
})
|
|
})
|
|
|
|
|
|
s.subscriptions_count = 2
|
|
s.subscriptions_count = 2
|
|
s.save()
|
|
s.save()
|
|
|
|
+ total_recurring_price = 10/(365*3)*365.25/12
|
|
|
|
|
|
self.assertEqual(s.get_prices(), {
|
|
self.assertEqual(s.get_prices(), {
|
|
- 'total_recurring_price': 10/(365*3)*365.25/12,
|
|
|
|
- 'unit_recurring_price': 10/(365*3)*365.25/12/2,
|
|
|
|
- 'unit_goods_value_share': 5,
|
|
|
|
|
|
+ 'total_recurring_price': total_recurring_price,
|
|
'total_goods_value_share': 10,
|
|
'total_goods_value_share': 10,
|
|
|
|
+ 'unit_recurring_price': total_recurring_price/2,
|
|
|
|
+ 'unit_goods_value_share': 5,
|
|
|
|
+ 'unit_staggered_goods_share': 5/36,
|
|
|
|
+ 'unit_consolidated_cost': total_recurring_price/2 + 5/36,
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|