Commit 5979e6fe authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: test: fix consistency on Hosting Subscription does not set the periodicity date

parent 61c5d678
...@@ -2,51 +2,12 @@ ...@@ -2,51 +2,12 @@
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin, simulate from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin, simulate
import transaction import transaction
from DateTime import DateTime
class TestSlapOSAccountingInteractionWorkflow(SlapOSTestCaseMixin): class TestSlapOSAccountingInteractionWorkflow(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
def _test_HostingSubscription_fixConsistency(self, day):
new_id = self.generateNewId()
item = self.portal.hosting_subscription_module.newContent(
portal_type='Hosting Subscription',
title="Subscription %s" % new_id,
reference="TESTSUB-%s" % new_id,
periodicity_hour_list=None,
periodicity_minute_list=None,
periodicity_month_day=None,
)
self.assertEqual(item.getPeriodicityHour(), None)
self.assertEqual(item.getPeriodicityMinute(), None)
self.assertEqual(item.getPeriodicityMonthDay(), None)
item.fixConsistency()
self.assertEqual(item.getPeriodicityHourList(), [0])
self.assertEqual(item.getPeriodicityMinuteList(), [0])
self.assertEqual(item.getPeriodicityMonthDay(), day)
@simulate('HostingSubscription_calculateSubscriptionStartDate',
'*args, **kwargs',
"""# Script body
from DateTime import DateTime
return DateTime('%s')
""" % DateTime('2012/01/15').ISO())
def test_HostingSubscription_fixConsistency(self):
self._test_HostingSubscription_fixConsistency(15)
@simulate('HostingSubscription_calculateSubscriptionStartDate',
'*args, **kwargs',
"""# Script body
from DateTime import DateTime
return DateTime('%s')
""" % DateTime('2012/01/29').ISO())
def test_HostingSubscription_fixConsistency_today_after_28(self):
self._test_HostingSubscription_fixConsistency(28)
@simulate('Delivery_calculate', @simulate('Delivery_calculate',
'*args, **kwargs', '*args, **kwargs',
"""# Script body """# Script body
......
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