Commit 177f34c3 authored by Romain Courteaud's avatar Romain Courteaud

Test that fixConsistency is called when calling an Hosting Subscription

parent f119b083
......@@ -159,3 +159,33 @@ class TestSlapOSAccountingInteractionWorkflow(testSlapOSMixin):
self.assertEqual(item.getPeriodicityMinuteList(), [0])
self.assertEqual(item.getPeriodicityMonthDay(), datetime.datetime.today().day)
def test_HostingSubscription_manageAfter(self):
class DummyTestException(Exception):
pass
def verify_fixConsistency_call(self):
# Check that fixConsistency is called on hosting subscription
if self.getRelativeUrl().startswith('hosting_subscription_module/'):
raise DummyTestException
else:
return self.fixConsistency_call()
# Replace serialize by a dummy method
from Products.ERP5Type.Base import Base
Base.fixConsistency_call = Base.fixConsistency
Base.fixConsistency = verify_fixConsistency_call
try:
# manage_afterAdd
self.assertRaises(
DummyTestException,
self.portal.hosting_subscription_module.newContent,
portal_type='Hosting Subscription')
# manage_afterClone
self.assertRaises(
DummyTestException,
self.portal.hosting_subscription_module.\
template_hosting_subscription.Base_createCloneDocument,
batch_mode=1)
finally:
Base.fixConsistency = Base.fixConsistency_call
54
\ No newline at end of file
55
\ No newline at end of file
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