Commit 01c4e280 authored by Łukasz Nowak's avatar Łukasz Nowak

Fix test.

Dates are document dependant.

Start date is moment when partition informed that got installed.
Stop date shall cover exactly one month.
parent ff40b534
import unittest import unittest
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.DateUtils import getClosestDate, addToDate from Products.ERP5Type.DateUtils import getClosestDate, addToDate, getNumberOfDayInMonth
from testVifibSlapWebService import TestVifibSlapWebServiceMixin from testVifibSlapWebService import TestVifibSlapWebServiceMixin
from DateTime.DateTime import DateTime from DateTime.DateTime import DateTime
...@@ -55,35 +55,23 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -55,35 +55,23 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
# check start date and stop date of the subscription item, # check start date and stop date of the subscription item,
# currently there is 1 month # currently there is 1 month
now = DateTime() instance_setup_delivery = self.portal.portal_catalog.getResultValue(
start_date = \ portal_type='Sale Packing List Line',
getClosestDate(target_date=now, precision='day', before=1) default_aggregate_uid=sequence['software_instance_uid'],
self.assertEquals( resource=self.portal.portal_preferences\
start_date.year(), open_order_line.getStartDate().year()) .getPreferredInstanceSetupResource()).getParentValue()
self.assertEquals(
start_date.month(), open_order_line.getStartDate().month()) self.assertEqual('stopped', instance_setup_delivery.getSimulationState())
self.assertEquals( start_date = None
start_date.day(), open_order_line.getStartDate().day()) for item in self.portal.portal_workflow.getInfoFor(
self.assertEquals( ob=instance_setup_delivery, name='history', wf_id='packing_list_workflow'):
0, open_order_line.getStartDate().hour()) if item.get('simulation_state') == 'stopped':
self.assertEquals( start_date = item.get('time')
0, open_order_line.getStartDate().minute()) break
self.assertEquals(
0.0, open_order_line.getStartDate().second()) self.assertEqual(start_date, open_order_line.getStartDate())
stop_date = addToDate( stop_date = start_date + getNumberOfDayInMonth(start_date)
getClosestDate(target_date=now, precision='month', before=1), month=1) self.assertEqual(stop_date, open_order_line.getStopDate())
self.assertEquals(
stop_date.year(), open_order_line.getStopDate().year())
self.assertEquals(
stop_date.month(), open_order_line.getStopDate().month())
self.assertEquals(
stop_date.day(), open_order_line.getStopDate().day())
self.assertEquals(
0, open_order_line.getStopDate().hour())
self.assertEquals(
0, open_order_line.getStopDate().minute())
self.assertEquals(
0.0, open_order_line.getStopDate().second())
# Calculate the list of time frames # Calculate the list of time frames
expected_time_frame_list = generateTimeFrameList(start_date) expected_time_frame_list = generateTimeFrameList(start_date)
......
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