def _restoreMailHost(self): """Restore original Mail Host """ cls = self.portal.MailHost.__class__ if cls.__bases__[0] is DummyMailHostMixin: cls.__bases__ = cls.__bases__[1:] pmc_init_of(cls)
def _setUpDummyMailHost(self): """Replace Original Mail Host by Dummy Mail Host in a non-persistent way """ cls = self.portal.MailHost.__class__ if not issubclass(cls, DummyMailHostMixin): cls.__bases__ = (DummyMailHostMixin,) + cls.__bases__ pmc_init_of(cls)
def resetAcquisition(cls): # First, fill the __get__ slot of the class # that has been null'ed after resetting its __bases__ # This descriptor is the magic allowing __of__ and our # _aq_dynamic trick pmc_init_of(cls) # And we need to do the same thing on subclasses for subclass in PortalTypeMetaClass.getSubclassList(cls): pmc_init_of(subclass)
def setupDummyMailHost(self): """Replace Original Mail Host by Dummy Mail Host in a non-persistent way Copied & pasted from ERP5TypeTestCaseMixin._setUpDummyMailHost """ cls = self.getPortalObject().portal.MailHost.__class__ if not issubclass(cls, DummyMailHostMixin): cls.__bases__ = (DummyMailHostMixin,) + cls.__bases__ pmc_init_of(cls) return True
def setupDummyMailHost(self): """Replace Original Mail Host by Dummy Mail Host in a non-persistent way Copied & pasted from ERP5TypeTestCaseMixin._setUpDummyMailHost """ cls = self.getPortalObject().MailHost.__class__ if not issubclass(cls, DummyMailHostMixin): cls.__bases__ = (DummyMailHostMixin, ) + cls.__bases__ pmc_init_of(cls) return True
def setupDummyMailHost(self): """Replace Original Mail Host by Dummy Mail Host in a non-persistent way and reset the list of already sent messages. Copied & pasted from ERP5TypeTestCaseMixin._setUpDummyMailHost """ mailhost = self.getPortalObject().MailHost cls = mailhost.__class__ if not issubclass(cls, DummyMailHostMixin): cls.__bases__ = (DummyMailHostMixin,) + cls.__bases__ pmc_init_of(cls) mailhost.reset() return True