diff --git a/master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingInteractionWorkflow.py b/master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingInteractionWorkflow.py index 4b159b8260cf51ac18786ac7a143028c17bdcf5f..8f87a6b47940fba9acbf662db2c650e343de8d2a 100644 --- a/master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingInteractionWorkflow.py +++ b/master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingInteractionWorkflow.py @@ -3,6 +3,7 @@ from Products.SlapOS.tests.testSlapOSMixin import \ testSlapOSMixin import transaction from Products.ERP5Type.tests.utils import createZODBPythonScript +from DateTime import DateTime class TestSlapOSAccountingInteractionWorkflow(testSlapOSMixin): def beforeTearDown(self): @@ -138,7 +139,8 @@ class TestSlapOSAccountingInteractionWorkflow(testSlapOSMixin): instance.requestStop(**request_kw) self.assertEqual(instance.getCausalityState(), 'diverged') - def test_HostingSubscription_fixConsistency(self): + def test_HostingSubscription_fixConsistency(self, + date=DateTime('2012/01/15'), day=15): new_id = self.generateNewId() item = self.portal.hosting_subscription_module.newContent( portal_type='Hosting Subscription', @@ -153,18 +155,23 @@ class TestSlapOSAccountingInteractionWorkflow(testSlapOSMixin): self.assertEqual(item.getPeriodicityMinute(), None) self.assertEqual(item.getPeriodicityMonthDay(), None) - item.fixConsistency() + try: + from Products.ERP5Type.Base import Base + Base.original_getCreationDate = Base.getCreationDate + def getCreationDate(*args, **kwargs): + return date + Base.getCreationDate = getCreationDate + item.fixConsistency() + finally: + Base.getCreationDate = Base.original_getCreationDate + delattr(Base, 'original_getCreationDate') - import datetime self.assertEqual(item.getPeriodicityHourList(), [0]) self.assertEqual(item.getPeriodicityMinuteList(), [0]) - day = datetime.datetime.today().day - if day > 28: - day = 28 self.assertEqual(item.getPeriodicityMonthDay(), day) def test_HostingSubscription_fixConsistency_today_after_28(self): - raise NotImplementedError('Test missing.') + self.test_HostingSubscription_fixConsistency(DateTime('2012/01/30'), 28) def test_HostingSubscription_manageAfter(self): class DummyTestException(Exception): diff --git a/master/bt5/slapos_accounting/bt/revision b/master/bt5/slapos_accounting/bt/revision index 0947c3313659827e4a73ff591c1fdcbccf9ed12f..66321c084ca9a642e8b308c01850cfd0351b48d1 100644 --- a/master/bt5/slapos_accounting/bt/revision +++ b/master/bt5/slapos_accounting/bt/revision @@ -1 +1 @@ -188 \ No newline at end of file +189 \ No newline at end of file