def setUp(self):
        super(TestInvitationFormEmailing, self).setUp()
        self.login_as_portal_owner()
        provideAdapter(adapts=(Interface, IBrowserRequest),
                       provides=Interface,
                       factory=InviteForm,
                       name="invite")

        # create a workspace
        self.ws = api.content.create(
            self.portal,
            "ploneintranet.workspace.workspacefolder",
            "alejandro-workspace",
            title="Alejandro workspace")

        self.app = self.layer['app']
        self.portal = self.layer['portal']
        self.request = self.layer['request']
        # don't import this at the top, because it screws up the setup
        # and none of the tests can run
        from Products.CMFPlone.tests.utils import MockMailHost
    #    # Mock the mail host so we can test sending the email
        mockmailhost = MockMailHost('MailHost')

        if not hasattr(mockmailhost, 'smtp_host'):
            mockmailhost.smtp_host = 'localhost'

        self.portal.MailHost = mockmailhost
        sm = self.portal.getSiteManager()
        sm.registerUtility(component=mockmailhost, provided=IMailHost)

        self.mailhost = api.portal.get_tool('MailHost')

        self.portal._updateProperty('email_from_name', 'Portal Owner')
        self.portal._updateProperty('email_from_address', '*****@*****.**')
Ejemplo n.º 2
0
    def setUp(self):
        self.app = self.layer['app']
        self.portal = self.layer['portal']
        self.request = self.layer['request']
        # Mock the mail host so we can test sending the email
        # NEVER EVER IMPORT MOCKMAILHOST OUTSIDE OF SETUP!
        # IT WILL BREAK YOUR TEST_ISOLATION AND KILL YOUR FIRSTBORN
        from Products.CMFPlone.tests.utils import MockMailHost
        from Products.MailHost.interfaces import IMailHost
        mockmailhost = MockMailHost('MailHost')

        if not hasattr(mockmailhost, 'smtp_host'):
            mockmailhost.smtp_host = 'localhost'

        self.portal.MailHost = mockmailhost
        sm = self.portal.getSiteManager()
        sm.registerUtility(component=mockmailhost, provided=IMailHost)

        self.mailhost = api.portal.get_tool('MailHost')
        registry = getUtility(IRegistry)
        self.mail_settings = registry.forInterface(IMailSchema, prefix="plone")
        self.mail_settings.email_from_name = u'Portal Owner'
        self.mail_settings.email_from_address = '*****@*****.**'

        self.browser = Browser(self.app)
        self.browser.handleErrors = False

        # Commit so that the test browser sees these changes
        import transaction
        transaction.commit()
Ejemplo n.º 3
0
    def setUp(self):
        """Shared test environment set-up, ran before every test."""
        self.portal = self.layer['portal']

        # Mock the mail host so we can test sending the email
        mockmailhost = MockMailHost('MailHost')

        if not getattr(mockmailhost, 'smtp_host', None):
            mockmailhost.smtp_host = 'localhost'

        self.portal.MailHost = mockmailhost
        sm = self.portal.getSiteManager()
        sm.registerUtility(component=mockmailhost, provided=IMailHost)

        self.mailhost = portal.get_tool('MailHost')
        if HAS_PLONE5:
            portal.set_registry_record(
                'plone.email_from_name', u'Portal Owner'
            )
            portal.set_registry_record(
                'plone.email_from_address',
                '*****@*****.**'
            )
        else:
            self.portal._updateProperty('email_from_name', 'Portal Owner')
            self.portal._updateProperty(
                'email_from_address', '*****@*****.**'
            )
Ejemplo n.º 4
0
    def setUp(self):
        self.app = self.layer["app"]
        self.portal = self.layer["portal"]
        self.request = self.layer["request"]
        # Mock the mail host so we can test sending the email
        # NEVER EVER IMPORT MOCKMAILHOST OUTSIDE OF SETUP!
        # IT WILL BREAK YOUR TEST_ISOLATION AND KILL YOUR FIRSTBORN
        from Products.CMFPlone.tests.utils import MockMailHost
        from Products.MailHost.interfaces import IMailHost

        mockmailhost = MockMailHost("MailHost")

        if not hasattr(mockmailhost, "smtp_host"):
            mockmailhost.smtp_host = "localhost"

        self.portal.MailHost = mockmailhost
        sm = self.portal.getSiteManager()
        sm.registerUtility(component=mockmailhost, provided=IMailHost)

        self.mailhost = api.portal.get_tool("MailHost")
        registry = getUtility(IRegistry)
        self.mail_settings = registry.forInterface(IMailSchema, prefix="plone")
        self.mail_settings.email_from_name = u"Portal Owner"
        self.mail_settings.email_from_address = "*****@*****.**"

        self.browser = Browser(self.app)
        self.browser.handleErrors = False

        # Commit so that the test browser sees these changes
        import transaction

        transaction.commit()
Ejemplo n.º 5
0
    def setUp(self):
        """Shared test environment set-up, ran before every test."""
        self.portal = self.layer['portal']

        # Mock the mail host so we can test sending the email
        mockmailhost = MockMailHost('MailHost')

        if not getattr(mockmailhost, 'smtp_host', None):
            mockmailhost.smtp_host = 'localhost'

        self.portal.MailHost = mockmailhost
        sm = self.portal.getSiteManager()
        sm.registerUtility(component=mockmailhost, provided=IMailHost)

        self.mailhost = portal.get_tool('MailHost')
        if HAS_PLONE5:
            portal.set_registry_record(
                'plone.email_from_name',
                u'Portal Owner',
            )
            portal.set_registry_record(
                'plone.email_from_address',
                '*****@*****.**',
            )
        else:
            self.portal._updateProperty(
                'email_from_name',
                'Portal Owner',
            )
            self.portal._updateProperty(
                'email_from_address',
                '*****@*****.**',
            )
Ejemplo n.º 6
0
    def setUp(self):
        super(TestInvitationFormEmailing, self).setUp()
        self.login_as_portal_owner()
        provideAdapter(adapts=(Interface, IBrowserRequest),
                       provides=Interface,
                       factory=InviteForm,
                       name="invite")

        # create a workspace
        self.ws = api.content.create(self.workspace_container,
                                     "ploneintranet.workspace.workspacefolder",
                                     "alejandro-workspace",
                                     title="Alejandro workspace")

        self.app = self.layer['app']
        self.portal = self.layer['portal']
        self.request = self.layer['request']
        # don't import this at the top, because it screws up the setup
        # and none of the tests can run
        from Products.CMFPlone.tests.utils import MockMailHost
        #    # Mock the mail host so we can test sending the email
        mockmailhost = MockMailHost('MailHost')

        if not hasattr(mockmailhost, 'smtp_host'):
            mockmailhost.smtp_host = 'localhost'

        self.portal.MailHost = mockmailhost
        sm = self.portal.getSiteManager()
        sm.registerUtility(component=mockmailhost, provided=IMailHost)

        self.mailhost = api.portal.get_tool('MailHost')
        registry = getUtility(IRegistry)
        self.mail_settings = registry.forInterface(IMailSchema, prefix="plone")
        self.mail_settings.email_from_name = u'Portal Owner'
        self.mail_settings.email_from_address = '*****@*****.**'
    def setUp(self):
        self.app = self.layer['app']
        self.portal = self.layer['portal']
        self.request = self.layer['request']
        # Mock the mail host so we can test sending the email
        mockmailhost = MockMailHost('MailHost')

        if not hasattr(mockmailhost, 'smtp_host'):
            mockmailhost.smtp_host = 'localhost'

        self.portal.MailHost = mockmailhost
        sm = self.portal.getSiteManager()
        sm.registerUtility(component=mockmailhost, provided=IMailHost)

        self.mailhost = api.portal.get_tool('MailHost')

        self.portal._updateProperty('email_from_name', 'Portal Owner')
        self.portal._updateProperty('email_from_address', '*****@*****.**')

        self.browser = Browser(self.app)
        self.browser.handleErrors = False

        # Commit so that the test browser sees these changes
        import transaction
        transaction.commit()
Ejemplo n.º 8
0
    def setUpPloneSite(self, portal):
        portal.acl_users.userFolderAddUser(
            'admin',
            'secret',
            ['Manager'],
            []
        )
        login(portal, 'admin')
        portal.portal_workflow.setDefaultChain("simple_publication_workflow")
        setRoles(portal, TEST_USER_ID, ['Manager'])
        portal.invokeFactory(
            "Folder",
            id="test-folder",
            title=u"Test Folder"
        )
        # XXX: this is needed for tests that rely on the Members folder to be
        # present. This folder is otherwise created by a setup handler in
        # ATContentTypes, but that package is optional now.
        if 'Members' not in portal.keys():
            portal.invokeFactory(
                "Folder",
                id="Members",
                title=u"Members"
            )

        portal._original_MailHost = portal.MailHost
        mail_host = MockMailHost('MailHost')
        mail_host.smtp_host = 'localhost'
        portal.MailHost = mail_host
        site_manager = getSiteManager(portal)
        site_manager.unregisterUtility(provided=IMailHost)
        site_manager.registerUtility(mail_host, IMailHost)
    def setUp(self):
        self.app = self.layer['app']
        self.portal = self.layer['portal']
        self.request = self.layer['request']
        # Mock the mail host so we can test sending the email
        # NEVER EVER IMPORT MOCKMAILHOST OUTSIDE OF SETUP!
        # IT WILL BREAK YOUR TEST_ISOLATION AND KILL YOUR FIRSTBORN
        from Products.CMFPlone.tests.utils import MockMailHost
        from Products.MailHost.interfaces import IMailHost
        mockmailhost = MockMailHost('MailHost')

        if not hasattr(mockmailhost, 'smtp_host'):
            mockmailhost.smtp_host = 'localhost'

        self.portal.MailHost = mockmailhost
        sm = self.portal.getSiteManager()
        sm.registerUtility(component=mockmailhost, provided=IMailHost)

        self.mailhost = api.portal.get_tool('MailHost')

        self.portal._updateProperty('email_from_name', 'Portal Owner')
        self.portal._updateProperty('email_from_address', '*****@*****.**')

        self.browser = Browser(self.app)
        self.browser.handleErrors = False

        # Commit so that the test browser sees these changes
        import transaction
        transaction.commit()
Ejemplo n.º 10
0
    def setUp(self):
        """Shared test environment set-up, ran before every test."""
        self.portal = self.layer['portal']

        # Mock the mail host so we can test sending the email
        mockmailhost = MockMailHost('MailHost')

        if not hasattr(mockmailhost, 'smtp_host'):
            mockmailhost.smtp_host = 'localhost'

        self.portal.MailHost = mockmailhost
        sm = self.portal.getSiteManager()
        sm.registerUtility(component=mockmailhost, provided=IMailHost)

        self.mailhost = getToolByName(self.portal, 'MailHost')

        self.portal._updateProperty('email_from_name', 'Portal Owner')
        self.portal._updateProperty('email_from_address', '*****@*****.**')
Ejemplo n.º 11
0
    def setUpPloneSite(self, portal):
        super(EestecPortalLayer, self).setUpPloneSite(portal)

        # Mock MailHost
        mockmailhost = MockMailHost('MailHost')
        mockmailhost.smtp_host = 'nohost'
        portal.MailHost = mockmailhost
        sm = api.portal.get().getSiteManager()
        sm.registerUtility(component=mockmailhost, provided=IMailHost)

        # Login
        setRoles(portal, TEST_USER_ID, ['Manager'])
        login(portal, TEST_USER_NAME)

        # Rebuild the catalog and commit changes
        portal.portal_catalog.clearFindAndRebuild()
        import transaction
        transaction.commit()
Ejemplo n.º 12
0
    def setUp(self):
        """  """
        self.portal = self.layer['portal']

        # Mock the mail host so we can test sending the email
        mockmailhost = MockMailHost('MailHost')

        if not hasattr(mockmailhost, 'smtp_host'):
            mockmailhost.smtp_host = 'localhost'

        self.portal.MailHost = mockmailhost
        sm = self.portal.getSiteManager()
        sm.registerUtility(component=mockmailhost, provided=IMailHost)

        self.mailhost = getToolByName(self.portal, 'MailHost')

        self.portal._updateProperty('email_from_name', 'Portal Owner')
        self.portal._updateProperty('email_from_address', '*****@*****.**')
Ejemplo n.º 13
0
    def setUpPloneSite(self, portal):
        super(EestecPortalLayer, self).setUpPloneSite(portal)

        # Mock MailHost
        mockmailhost = MockMailHost('MailHost')
        mockmailhost.smtp_host = 'nohost'
        portal.MailHost = mockmailhost
        sm = api.portal.get().getSiteManager()
        sm.registerUtility(component=mockmailhost, provided=IMailHost)

        # Login
        setRoles(portal, TEST_USER_ID, ['Manager'])
        login(portal, TEST_USER_NAME)

        # Rebuild the catalog and commit changes
        portal.portal_catalog.clearFindAndRebuild()
        import transaction
        transaction.commit()
Ejemplo n.º 14
0
    def setUp(self):
        """Shared test environment set-up, ran before every test."""
        self.portal = self.layer["portal"]

        # Mock the mail host so we can test sending the email
        mockmailhost = MockMailHost("MailHost")

        if not hasattr(mockmailhost, "smtp_host"):
            mockmailhost.smtp_host = "localhost"

        self.portal.MailHost = mockmailhost
        sm = self.portal.getSiteManager()
        sm.registerUtility(component=mockmailhost, provided=IMailHost)

        self.mailhost = portal.get_tool("MailHost")

        self.portal._updateProperty("email_from_name", "Portal Owner")
        self.portal._updateProperty("email_from_address", "*****@*****.**")
Ejemplo n.º 15
0
    def setUpPloneSite(self, portal):
        portal.acl_users.userFolderAddUser('admin', 'secret', ['Manager'], [])
        login(portal, 'admin')
        portal.portal_workflow.setDefaultChain("simple_publication_workflow")
        setRoles(portal, TEST_USER_ID, ['Manager'])
        portal.invokeFactory("Folder", id="test-folder", title=u"Test Folder")
        # XXX: this is needed for tests that rely on the Members folder to be
        # present. This folder is otherwise created by a setup handler in
        # ATContentTypes, but that package is optional now.
        if 'Members' not in portal.keys():
            portal.invokeFactory("Folder", id="Members", title=u"Members")

        portal._original_MailHost = portal.MailHost
        mail_host = MockMailHost('MailHost')
        mail_host.smtp_host = 'localhost'
        portal.MailHost = mail_host
        site_manager = getSiteManager(portal)
        site_manager.unregisterUtility(provided=IMailHost)
        site_manager.registerUtility(mail_host, IMailHost)