Commit dd75f1e4 authored by Łukasz Nowak's avatar Łukasz Nowak

Follow code changes.

Prove that Subscription Item periodicity is correctly defined.
parent 2790581c
...@@ -27,6 +27,26 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -27,6 +27,26 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
"portal_rules/vifib_subscription_item_rule", "portal_rules/vifib_subscription_item_rule",
applied_rule.getSpecialise()) applied_rule.getSpecialise())
# check start date and stop date of the subscription item,
# currently there is 1 month
instance_setup_delivery = self.portal.portal_catalog.getResultValue(
portal_type='Sale Packing List Line',
default_aggregate_uid=sequence['software_instance_uid'],
resource=self.portal.portal_preferences\
.getPreferredInstanceSetupResource()).getParentValue()
self.assertEqual('stopped', instance_setup_delivery.getSimulationState())
start_date = None
for item in self.portal.portal_workflow.getInfoFor(
ob=instance_setup_delivery, name='history', wf_id='packing_list_workflow'):
if item.get('simulation_state') == 'stopped':
start_date = item.get('time')
break
start_date = getClosestDate(target_date=start_date, precision='day')
while start_date.day() >= 29:
start_date = addToDate(start_date, to_add={'day': -1})
stop_date = addToDate(start_date, to_add={'month': 1})
# check periodicity, should be first day of each month # check periodicity, should be first day of each month
self.assertEquals( self.assertEquals(
None, hosting_subscription.getPeriodicityMinuteFrequency()) None, hosting_subscription.getPeriodicityMinuteFrequency())
...@@ -41,28 +61,11 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -41,28 +61,11 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
self.assertEquals( self.assertEquals(
None, hosting_subscription.getPeriodicityMonthFrequency()) None, hosting_subscription.getPeriodicityMonthFrequency())
self.assertEquals( self.assertEquals(
[1], hosting_subscription.getPeriodicityMonthDayList()) [start_date.day()], hosting_subscription.getPeriodicityMonthDayList())
self.assertEquals( self.assertEquals(
None, hosting_subscription.getPeriodicityWeekFrequency()) None, hosting_subscription.getPeriodicityWeekFrequency())
# check start date and stop date of the subscription item,
# currently there is 1 month
instance_setup_delivery = self.portal.portal_catalog.getResultValue(
portal_type='Sale Packing List Line',
default_aggregate_uid=sequence['software_instance_uid'],
resource=self.portal.portal_preferences\
.getPreferredInstanceSetupResource()).getParentValue()
self.assertEqual('stopped', instance_setup_delivery.getSimulationState())
start_date = None
for item in self.portal.portal_workflow.getInfoFor(
ob=instance_setup_delivery, name='history', wf_id='packing_list_workflow'):
if item.get('simulation_state') == 'stopped':
start_date = item.get('time')
break
self.assertEqual(start_date, open_order_line.getStartDate()) self.assertEqual(start_date, open_order_line.getStartDate())
stop_date = start_date + getNumberOfDayInMonth(start_date)
self.assertEqual(stop_date, open_order_line.getStopDate()) self.assertEqual(stop_date, open_order_line.getStopDate())
simulation_movement_list = self.portal.portal_catalog( simulation_movement_list = self.portal.portal_catalog(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment