Repository: plone.app.users
Branch: refs/heads/master
Date: 2014-11-15T14:41:51+01:00
Author: Kees Hink (khink) <keeshink@gmail.com>
Commit: https://github.com/plone/plone.app.users/commit/2a1f19d699917ad04f448c8daf8bf168c6061e92

Use email_from_address from registry (Plone 5) in tests.

Files changed:
M CHANGES.rst
M plone/app/users/tests/base.py
M setup.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 495ba04..70bc016 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,10 +1,11 @@
 CHANGES
 =======
 
-2.1.1 (unreleased)
-------------------
+2.2 (unreleased)
+----------------
 
-- Nothing changed yet.
+- Use email_from_address from registry (Plone 5) in tests.
+  [khink]
 
 
 2.1.0 (2014-10-23)
diff --git a/plone/app/users/tests/base.py b/plone/app/users/tests/base.py
index e7b7271..e26b284 100644
--- a/plone/app/users/tests/base.py
+++ b/plone/app/users/tests/base.py
@@ -8,6 +8,7 @@
 from AccessControl.SecurityInfo import ClassSecurityInfo
 from Acquisition import aq_base
 from Products.CMFCore.interfaces import ISiteRoot
+from Products.CMFPlone.interfaces.controlpanel import IMailSchema
 from Products.CMFPlone.tests.utils import MockMailHost
 from Products.MailHost.interfaces import IMailHost
 from Products.PlonePAS.Extensions.Install import activatePluginInterfaces
@@ -16,6 +17,7 @@
 from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
 from Products.PluggableAuthService.utils import classImplements
 from OFS.Cache import Cacheable
+from plone.registry.interfaces import IRegistry
 from zope.component import getSiteManager
 from zope.component import getUtility
 
@@ -82,12 +84,16 @@ def beforeTearDown(self):
             pas_instance.manage_delObjects('test')
 
     def setMailHost(self):
-        self.portal.MailHost.smtp_host = 'localhost'
-        setattr(self.portal, 'email_from_address', 'admin@foo.com')
+        registry = getUtility(IRegistry)
+        mail_settings = registry.forInterface(IMailSchema, prefix='plone')
+        mail_settings.smtp_host = u'localhost'
+        mail_settings.email_from_address = 'admin@foo.com'
 
     def unsetMailHost(self):
-        self.portal.MailHost.smtp_host = ''
-        setattr(self.portal, 'email_from_address', '')
+        registry = getUtility(IRegistry)
+        mail_settings = registry.forInterface(IMailSchema, prefix='plone')
+        mail_settings.smtp_host = u''
+        mail_settings.email_from_address = ''
 
     def test_nothing(self):
         """Add a dummy test here, so the base class 'passes'."""
diff --git a/setup.py b/setup.py
index 217564a..554bc04 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@
 from setuptools import find_packages
 from setuptools import setup
 
-version = '2.1.1.dev0'
+version = '2.2.dev0'
 
 long_description = '{0}\n{1}'.format(open('README.rst').read(),
                                      open('CHANGES.rst').read())


Repository: plone.app.users
Branch: refs/heads/master
Date: 2014-12-12T13:55:03+01:00
Author: Timo Stollenwerk (tisto) <tisto@plone.org>
Commit: https://github.com/plone/plone.app.users/commit/3aa016c2d10713f78e5c27975fa50ac2f445ef84

Merge pull request #27 from plone/plip10359-mail-controlpanel

Use email_from_address from registry (Plone 5) in tests.

Files changed:
M CHANGES.rst
M plone/app/users/tests/base.py
M setup.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 495ba04..70bc016 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,10 +1,11 @@
 CHANGES
 =======
 
-2.1.1 (unreleased)
-------------------
+2.2 (unreleased)
+----------------
 
-- Nothing changed yet.
+- Use email_from_address from registry (Plone 5) in tests.
+  [khink]
 
 
 2.1.0 (2014-10-23)
diff --git a/plone/app/users/tests/base.py b/plone/app/users/tests/base.py
index e7b7271..e26b284 100644
--- a/plone/app/users/tests/base.py
+++ b/plone/app/users/tests/base.py
@@ -8,6 +8,7 @@
 from AccessControl.SecurityInfo import ClassSecurityInfo
 from Acquisition import aq_base
 from Products.CMFCore.interfaces import ISiteRoot
+from Products.CMFPlone.interfaces.controlpanel import IMailSchema
 from Products.CMFPlone.tests.utils import MockMailHost
 from Products.MailHost.interfaces import IMailHost
 from Products.PlonePAS.Extensions.Install import activatePluginInterfaces
@@ -16,6 +17,7 @@
 from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
 from Products.PluggableAuthService.utils import classImplements
 from OFS.Cache import Cacheable
+from plone.registry.interfaces import IRegistry
 from zope.component import getSiteManager
 from zope.component import getUtility
 
@@ -82,12 +84,16 @@ def beforeTearDown(self):
             pas_instance.manage_delObjects('test')
 
     def setMailHost(self):
-        self.portal.MailHost.smtp_host = 'localhost'
-        setattr(self.portal, 'email_from_address', 'admin@foo.com')
+        registry = getUtility(IRegistry)
+        mail_settings = registry.forInterface(IMailSchema, prefix='plone')
+        mail_settings.smtp_host = u'localhost'
+        mail_settings.email_from_address = 'admin@foo.com'
 
     def unsetMailHost(self):
-        self.portal.MailHost.smtp_host = ''
-        setattr(self.portal, 'email_from_address', '')
+        registry = getUtility(IRegistry)
+        mail_settings = registry.forInterface(IMailSchema, prefix='plone')
+        mail_settings.smtp_host = u''
+        mail_settings.email_from_address = ''
 
     def test_nothing(self):
         """Add a dummy test here, so the base class 'passes'."""
diff --git a/setup.py b/setup.py
index 217564a..554bc04 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@
 from setuptools import find_packages
 from setuptools import setup
 
-version = '2.1.1.dev0'
+version = '2.2.dev0'
 
 long_description = '{0}\n{1}'.format(open('README.rst').read(),
                                      open('CHANGES.rst').read())