예제 #1
0
    def afterSetUp(self):
        PloneTestCase.afterSetUp(self)

        self.setRoles(['Manager'])
        addPloneSite(self.app, 'login_portal',
                     content_profile_id='Products.ATContentTypes:default')
        addPloneSite(self.app, 'another_portal',
                     content_profile_id='Products.ATContentTypes:default')

        self.browser = Browser(self.app)
        self.browser.handleErrors = False  # Don't get HTTP 500 pages

        self.login_portal = self.app.login_portal  # logins go here
        self.another_portal = self.app.another_portal  # another portal
        # The extra portals do not get a member setup from the base class.
        # Add our user to the other portals to simulate an ldap environment.
        for portal in (self.login_portal, self.another_portal):
            portal.acl_users.source_users.addUser(
                TEST_USER_ID,
                TEST_USER_NAME,
                TEST_USER_PASSWORD)
        for role in TEST_USER_ROLES:
            portal.acl_users.portal_role_manager.doAssignRoleToPrincipal(
                TEST_USER_ID, role)

        # Configure the login portal to allow logins from our sites.
        login_registry = self.login_portal.portal_registry
        login_registry['plone.allow_external_login_sites'] = (
            self.portal.absolute_url(),
            self.another_portal.absolute_url())

        # The normal portal needs to allow logins from the login portal,
        # otherwise the redirect_to action on login or logout will refuse to
        # redirect externally.  This may need to be done on another_portal too,
        # but for the current tests this is not needed.
        portal_registry = self.portal.portal_registry
        portal_registry['plone.allow_external_login_sites'] = (
            self.login_portal.absolute_url(), )

        # Configure our sites to use the login portal for logins and logouts
        login_portal_url = self.login_portal.absolute_url()
        for portal in (self.portal, self.another_portal):
            reg = portal.portal_registry
            reg['plone.external_login_url'] = login_portal_url + '/login'
            reg['plone.external_logout_url'] = login_portal_url + '/logout'

        # Configure all sites to use a shared secret and set cookies per path
        # (normally they would have different domains.)
        for portal in (self.portal, self.login_portal, self.another_portal):
            session = portal.acl_users.session
            session._shared_secret = 'secret'
            session.path = portal.absolute_url_path()

        # Turn on self-registration
        self.portal.manage_permission('Add portal member',
                                      roles=['Manager', 'Anonymous'],
                                      acquire=0)

        transaction.commit()
    def afterSetUp(self):
        PloneTestCase.afterSetUp(self)

        self.setRoles(['Manager'])
        addPloneSite(self.app,
                     'login_portal',
                     content_profile_id='Products.ATContentTypes:default')
        addPloneSite(self.app,
                     'another_portal',
                     content_profile_id='Products.ATContentTypes:default')

        self.browser = Browser(self.app)
        self.browser.handleErrors = False  # Don't get HTTP 500 pages

        self.login_portal = self.app.login_portal  # logins go here
        self.another_portal = self.app.another_portal  # another portal
        # The extra portals do not get a member setup from the base class.
        # Add our user to the other portals to simulate an ldap environment.
        for portal in (self.login_portal, self.another_portal):
            portal.acl_users.source_users.addUser(TEST_USER_ID, TEST_USER_NAME,
                                                  TEST_USER_PASSWORD)
        for role in TEST_USER_ROLES:
            portal.acl_users.portal_role_manager.doAssignRoleToPrincipal(
                TEST_USER_ID, role)

        # Configure the login portal to allow logins from our sites.
        login_registry = self.login_portal.portal_registry
        login_registry['plone.allow_external_login_sites'] = (
            self.portal.absolute_url(), self.another_portal.absolute_url())

        # The normal portal needs to allow logins from the login portal,
        # otherwise the redirect_to action on login or logout will refuse to
        # redirect externally.  This may need to be done on another_portal too,
        # but for the current tests this is not needed.
        portal_registry = self.portal.portal_registry
        portal_registry['plone.allow_external_login_sites'] = (
            self.login_portal.absolute_url(), )

        # Configure our sites to use the login portal for logins and logouts
        login_portal_url = self.login_portal.absolute_url()
        for portal in (self.portal, self.another_portal):
            reg = portal.portal_registry
            reg['plone.external_login_url'] = login_portal_url + '/login'
            reg['plone.external_logout_url'] = login_portal_url + '/logout'

        # Configure all sites to use a shared secret and set cookies per path
        # (normally they would have different domains.)
        for portal in (self.portal, self.login_portal, self.another_portal):
            session = portal.acl_users.session
            session._shared_secret = 'secret'
            session.path = portal.absolute_url_path()

        # Turn on self-registration
        self.portal.manage_permission('Add portal member',
                                      roles=['Manager', 'Anonymous'],
                                      acquire=0)

        transaction.commit()
예제 #3
0
파일: base.py 프로젝트: a25kk/mp-bbb
    def afterSetUp(self):
        PloneTestCase.afterSetUp(self)

        # define some instance variables for convenience
        self.mbtool = self.portal.membrane_tool
        mtool = self.mtool = getToolByName(self.portal,
                                           'portal_membership')
        
        self.blank_member = mtool.getMemberById('blank_member')
        self.portal_member = mtool.getMemberById('portal_member')
        self.admin_member = mtool.getMemberById('admin_member')

        self.login('portal_member')
    def afterSetUp(self):
        PloneTestCase.afterSetUp(self)

        self.setRoles(["Manager"])
        addPloneSite(self.app, "login_portal", content_profile_id="Products.ATContentTypes:default")
        addPloneSite(self.app, "another_portal", content_profile_id="Products.ATContentTypes:default")

        self.browser = Browser(self.app)
        self.browser.handleErrors = False  # Don't get HTTP 500 pages

        self.login_portal = self.app.login_portal  # logins go here
        self.another_portal = self.app.another_portal  # another portal
        # The extra portals do not get a member setup from the base class.
        # Add our user to the other portals to simulate an ldap environment.
        for portal in (self.login_portal, self.another_portal):
            portal.acl_users.source_users.addUser(TEST_USER_ID, TEST_USER_NAME, TEST_USER_PASSWORD)
        for role in TEST_USER_ROLES:
            portal.acl_users.portal_role_manager.doAssignRoleToPrincipal(TEST_USER_ID, role)

        registry = self.login_portal.portal_registry

        # Configure the login portal to allow logins from our sites.
        registry["plone.allow_external_login_sites"] = (self.portal.absolute_url(), self.another_portal.absolute_url())

        # Configure our sites to use the login portal for logins and logouts
        login_portal_url = self.login_portal.absolute_url()
        for portal in (self.portal, self.another_portal):
            reg = portal.portal_registry
            reg["plone.external_login_url"] = login_portal_url + "/login"
            reg["plone.external_logout_url"] = login_portal_url + "/logout"

        # Configure all sites to use a shared secret and set cookies per path
        # (normally they would have different domains.)
        for portal in (self.portal, self.login_portal, self.another_portal):
            session = portal.acl_users.session
            session._shared_secret = "secret"
            session.path = portal.absolute_url_path()

        # Turn on self-registration
        self.portal.manage_permission("Add portal member", roles=["Manager", "Anonymous"], acquire=0)

        transaction.commit()
예제 #5
0
 def afterSetUp(self):
     PloneTestCase.afterSetUp(self)
     ConvergenceTestCaseMixin.afterSetUp(self)