Commit 8a48bdcd authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio_ui_test: Add utility script to restore MailHost to original

When you run tests, MailHost is normally changed to DummyMailHost, this script helps you to restore, in case you want to configure your development instance as a demo site.
parent 3590cbe0
Pipeline #9573 failed with stage
in 0 seconds
from ExtensionClass import pmc_init_of
from Products.ERP5Type.tests.utils import DummyMailHostMixin
from AccessControl.SecurityManagement import getSecurityManager
from AccessControl.SecurityManagement import setSecurityManager
from AccessControl.SecurityManagement import newSecurityManager
......@@ -94,3 +97,17 @@ def Computer_simulateSlapgridFormat(self, partition_count=10):
xml_marshaller.xml_marshaller.dumps(computer_dict))
finally:
setSecurityManager(sm)
def restoreDummyMailHost(self):
"""Restore the replacement of Original Mail Host by Dummy Mail Host.
Copied & pasted from ERP5TypeTestCaseMixin._restoreMailHost
"""
mailhost = self.getPortalObject().MailHost
cls = mailhost.__class__
if cls.__bases__[0] is DummyMailHostMixin:
cls.__bases__ = cls.__bases__[1:]
pmc_init_of(cls)
return True
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>restoreDummyMailHost</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>SlapOSUiTest</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_restoreDummyMailHost</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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