Commit e1a9e318 authored by Rafael Monnerat's avatar Rafael Monnerat

testSlapOSMixin: Dont custom DummyMailHost setup

  Rely on standard ERP5 implementation is enough
parent 40429299
...@@ -30,7 +30,6 @@ import random ...@@ -30,7 +30,6 @@ import random
import transaction import transaction
import unittest import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import DummyMailHost
from Products.ERP5Type.Utils import convertToUpperCase from Products.ERP5Type.Utils import convertToUpperCase
import os import os
import glob import glob
...@@ -131,19 +130,7 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -131,19 +130,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
# XXX - What is the better way to know if we are in live test mode ? # XXX - What is the better way to know if we are in live test mode ?
return not os.environ.has_key('TEST_CA_PATH') return not os.environ.has_key('TEST_CA_PATH')
def _setUpDummyMailHost(self):
"""Do not play with NON persistent replacement of MailHost"""
if not self.isLiveTest():
ERP5TypeTestCase._setUpDummyMailHost(self)
def _restoreMailHost(self):
"""Do not play with NON persistent replacement of MailHost"""
if not self.isLiveTest():
ERP5TypeTestCase._restoreMailHost(self)
def beforeTearDown(self): def beforeTearDown(self):
if self.isLiveTest():
self.deSetUpPersistentDummyMailHost()
if self.abort_transaction: if self.abort_transaction:
transaction.abort() transaction.abort()
...@@ -170,6 +157,9 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -170,6 +157,9 @@ class testSlapOSMixin(ERP5TypeTestCase):
def afterSetUp(self): def afterSetUp(self):
self.login() self.login()
self.createAlarmStep() self.createAlarmStep()
self.portal.email_from_address = 'romain@nexedi.com'
self.portal.email_to_address = 'romain@nexedi.com'
if getattr(self.portal.portal_caches, 'erp5_site_global_id', None): if getattr(self.portal.portal_caches, 'erp5_site_global_id', None):
# we are not on live test so multiple tests can run in parallel # we are not on live test so multiple tests can run in parallel
...@@ -178,26 +168,11 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -178,26 +168,11 @@ class testSlapOSMixin(ERP5TypeTestCase):
self.portal.portal_caches._p_changed = 1 self.portal.portal_caches._p_changed = 1
if self.isLiveTest(): if self.isLiveTest():
self.setUpPersistentDummyMailHost()
return return
self.createCertificateAuthorityFile() self.createCertificateAuthorityFile()
self.commit() self.commit()
self.updateInitSite() self.updateInitSite()
def deSetUpPersistentDummyMailHost(self):
if 'MailHost' in self.portal.objectIds():
self.portal.manage_delObjects(['MailHost'])
self.portal.manage_addProduct['MailHost'].manage_addMailHost('MailHost')
self.commit()
def setUpPersistentDummyMailHost(self):
if 'MailHost' in self.portal.objectIds():
self.portal.manage_delObjects(['MailHost'])
self.portal._setObject('MailHost', DummyMailHost('MailHost'))
self.portal.email_from_address = 'romain@nexedi.com'
self.portal.email_to_address = 'romain@nexedi.com'
def getBusinessConfiguration(self): def getBusinessConfiguration(self):
return self.portal.business_configuration_module[\ return self.portal.business_configuration_module[\
"slapos_master_configuration_workflow"] "slapos_master_configuration_workflow"]
......
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