Esempio n. 1
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'portal': portal,
        'browser': browser,
    })

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    regtool = getToolByName(portal, 'portal_registration')

    regtool.addMember('*****@*****.**', 'member1')
    setRoles(portal, '*****@*****.**', ['Member'])

    regtool.addMember('*****@*****.**', 'member2')
    setRoles(portal, '*****@*****.**', ['Member'])

    transaction.commit()
Esempio n. 2
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']

    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    user2 = 'test_user_2_'
    regtool = getToolByName(portal, 'portal_registration')
    regtool.addMember(user2, user2)
    setRoles(portal, user2, ['Editor'])
    self.globs['user2'] = user2

    transaction.commit()
Esempio n. 3
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'portal': portal,
        'browser': browser,
    })
    ztc.utils.setupCoreSessions(layer['app'])
    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    alsoProvides(portal, IShoppingSiteRoot)

    # Set the site back in English mode to make testing easier.
    portal.portal_languages.manage_setLanguageSettings('en', ['en', 'fi'])

    # Set title and description for the plone site.
    portal.manage_changeProperties(
        title='Luonnonsuojelukauppa',
        description='Suomen Luonnonsuojelun Tuki Oy')

    regtool = getToolByName(portal, 'portal_registration')
    regtool.addMember('member1', 'member1')
    setRoles(portal, 'member1', ['Member'])

    transaction.commit()
Esempio n. 4
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']

    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    # Create News Item.
    newsitem = portal[portal.invokeFactory('News Item', 'newsitem')]
    newsitem.reindexObject()

    # Set the site back in English mode to make testing easier.
    portal.portal_languages.manage_setLanguageSettings('en', ['en', 'fi'])

    transaction.commit()
Esempio n. 5
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'portal': portal,
        'browser': browser,
    })
    ztc.utils.setupCoreSessions(layer['app'])
    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    alsoProvides(portal, IShoppingSiteRoot)

    # Set the site back in English mode to make testing easier.
    portal.portal_languages.manage_setLanguageSettings('en', ['en', 'fi'])

    # Set title and description for the plone site.
    portal.manage_changeProperties(title='Luonnonsuojelukauppa', description='Suomen Luonnonsuojelun Tuki Oy')

    regtool = getToolByName(portal, 'portal_registration')
    regtool.addMember('member1', 'member1')
    setRoles(portal, 'member1', ['Member'])

    transaction.commit()
Esempio n. 6
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']

    self.globs.update({
        'portal': portal,
        'browser': browser,
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
    })

    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    document = portal[portal.invokeFactory(
        'Document',
        'document',
        title='Title of Document',
        description='Description of Document',
        text='<p>This is the body text of Document.</p>',
    )]
    document.reindexObject()

    transaction.commit()
Esempio n. 7
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']

    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    membership = getToolByName(portal, 'portal_membership')
    # membership.setMemberAreaType('Folder')
    membership.memberareaCreationFlag = True

    regtool = getToolByName(portal, 'portal_registration')

    regtool.addMember('member1', 'member1')
    setRoles(portal, 'member1', ['Member'])

    transaction.commit()
Esempio n. 8
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    self.globs.update({
        'browser': browser,
        'portal': portal,
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
    })

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    # portal._original_MailHost = portal.MailHost
    portal.MailHost = mailhost = MockMailHost('MailHost')
    sm = getSiteManager(context=portal)
    sm.unregisterUtility(provided=IMailHost)
    sm.registerUtility(mailhost, provided=IMailHost)
    self.globs['messages'] = mailhost.messages
    self.globs['prink'] = prink

    transaction.commit()
Esempio n. 9
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']

    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    # Create News Item.
    newsitem = portal[portal.invokeFactory('News Item', 'newsitem')]
    newsitem.reindexObject()

    # Set the site back in English mode to make testing easier.
    portal.portal_languages.manage_setLanguageSettings('en', ['en', 'fi'])

    transaction.commit()
Esempio n. 10
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']

    self.globs.update({
        'portal': portal,
        'browser': browser,
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
    })

    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    document = portal[
        portal.invokeFactory(
            'Document',
            'document',
            title='Title of Document',
            description='Description of Document',
            text='<p>This is the body text of Document.</p>',
        )
    ]
    document.reindexObject()

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    portal = layer['portal']
    browser = Browser(layer['app'])
    self.globs.update({
        'portal': portal,
        'browser': browser,
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
    })
    ztc.utils.setupCoreSessions(layer['app'])
    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    basic = 'Basic {0}:{1}'.format(TEST_USER_NAME, TEST_USER_PASSWORD)
    browser.setHeader('Authorization', basic)

    # Create Form Folder
    portal.invokeFactory('FormFolder', 'form', title="Form Folder")
    form = portal.form
    form_url = form.absolute_url()
    self.globs.update({
        'form': form,
        'form_url': form_url,
    })
    for key in list(form.keys()):
        del form[key]
    form.thanksPage = ''
    form.reindexObject()

    transaction.commit()
def setUp(self):
    layer = self.globs["layer"]
    browser = Browser(layer["app"])
    portal = layer["portal"]
    # Update global variables within the tests.
    self.globs.update(
        {
            "browser": browser,
            "portal": portal,
            "TEST_USER_NAME": TEST_USER_NAME,
            "TEST_USER_PASSWORD": TEST_USER_PASSWORD,
        }
    )

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ["Manager"])

    data_path = "/".join(__file__.split("/")[:-1] + ["files", "data.csv"])
    self.globs["data_path"] = data_path
    self.globs["data_file"] = open(data_path)

    transaction.commit()
Esempio n. 13
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Site Administrator'])
    # setRoles(portal, TEST_USER_ID, ['Manager'])

    # Create folder.
    folder = portal[portal.invokeFactory('Folder', 'folder')]
    folder.reindexObject()

    transaction.commit()
Esempio n. 14
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']

    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    footer_info = portal[portal.invokeFactory('Folder', 'footer-info')]
    footer_info.reindexObject()
    info1 = footer_info[footer_info.invokeFactory(
        'Document', 'info1', title="Info1", text='<p>Text of Info1</p>')]
    info1.reindexObject()
    info2 = footer_info[footer_info.invokeFactory(
        'Document', 'info2', title="Info2", text='<p>Text of Info2</p>')]
    info2.reindexObject()
    info3 = footer_info[footer_info.invokeFactory(
        'Document', 'info3', title="Info3", text='<p>Text of Info3</p>')]
    info3.reindexObject()

    transaction.commit()
def setUp(self):
    layer = self.globs["layer"]
    portal = layer["portal"]
    browser = Browser(layer["app"])
    # Update global variables within the tests.
    self.globs.update(
        {
            "portal": portal,
            "browser": browser,
            "TEST_USER_NAME": TEST_USER_NAME,
            "TEST_USER_PASSWORD": TEST_USER_PASSWORD,
        }
    )

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ["Manager"])

    # Set the site back in English mode to make testing easier.
    portal.portal_languages.manage_setLanguageSettings("en", ["en", "fi"])

    transaction.commit()
Esempio n. 16
0
def setUp(self):
    layer = self.globs['layer']
    portal = layer['portal']
    browser = Browser(layer['app'])
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    doc1 = portal[portal.invokeFactory(
        'Document',
        'doc1',
        title="Döcument1",
        description="Descriptiön of Döcument1.")]
    doc1.reindexObject()

    transaction.commit()
Esempio n. 17
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })
    ztc.utils.setupCoreSessions(layer['app'])
    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    regtool = getToolByName(portal, 'portal_registration')

    member1 = 'member1'
    regtool.addMember(member1, member1)
    setRoles(portal, member1, ['Member'])
    self.globs['member1'] = member1

    member2 = 'member2'
    regtool.addMember(member2, member2)
    setRoles(portal, member2, ['Member'])
    member = getToolByName(portal, 'portal_membership').getMemberById('member2')
    member.setMemberProperties({'registration_number': 'RN'})
    self.globs['member2'] = member2

    self.globs['today'] = date.today()

    transaction.commit()
def setUp(self):
    layer = self.globs["layer"]
    app = layer["app"]
    browser = Browser(app)
    portal = layer["portal"]

    self.globs.update(
        {
            "TEST_USER_NAME": TEST_USER_NAME,
            "TEST_USER_PASSWORD": TEST_USER_PASSWORD,
            "browser": browser,
            "portal": portal,
        }
    )

    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ["Manager"])

    ztc.utils.setupCoreSessions(app)
    wftool = getToolByName(portal, "portal_workflow")
    portal.invokeFactory("FormFolder", "form01", title="Form01", thanksPageOverride="traverse_to:string:form02")
    form01 = portal.form01
    form01.actionAdapter = ()
    wftool.doActionFor(form01, "publish")
    form01.reindexObject()
    portal.invokeFactory("FormFolder", "form02", title="Form02", thanksPageOverride="traverse_to:string:form2")
    form02 = portal.form02
    wftool.doActionFor(form02, "publish")
    form02.reindexObject()
    del form02["thank-you"]
    del form02["mailer"]

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })
    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    alsoProvides(portal, IShoppingSiteRoot)
    portal.reindexObject()

    container = createContentInContainer(
        portal, 'collective.cart.core.OrderContainer', checkConstraints=False, id='order-container', title='Örder Cöntäiner')
    modified(container)

    order1 = createContentInContainer(container, 'collective.cart.core.Order', checkConstraints=False, id='1')
    modified(order1)

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    self.globs.update({
        'browser': browser,
        'portal': portal,
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
    })

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    # portal._original_MailHost = portal.MailHost
    portal.MailHost = mailhost = MockMailHost('MailHost')
    sm = getSiteManager(context=portal)
    sm.unregisterUtility(provided=IMailHost)
    sm.registerUtility(mailhost, provided=IMailHost)
    self.globs['messages'] = mailhost.messages
    self.globs['prink'] = prink

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    workflow = getToolByName(portal, 'portal_workflow')

    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
        'workflow': workflow,
    })

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    setUpDefaultMembersBoardAndForum(portal)
    setRoles(portal, 'reviewer1', ['Reviewer'])

    board = portal['board1']
    forum = board['forum1']
    self.globs['board'] = board
    self.globs['forum'] = forum

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Site Administrator'])
    # setRoles(portal, TEST_USER_ID, ['Manager'])

    # Create folder.
    folder = portal[portal.invokeFactory('Folder', 'folder')]
    folder.reindexObject()

    transaction.commit()
def setUp(self):
    layer = self.globs["layer"]
    portal = layer["portal"]
    browser = Browser(layer["app"])
    # Update global variables within the tests.
    self.globs.update(
        {
            "portal": portal,
            "browser": browser,
            "TEST_USER_NAME": TEST_USER_NAME,
            "TEST_USER_PASSWORD": TEST_USER_PASSWORD,
        }
    )

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ["Manager"])

    doc1 = portal[portal.invokeFactory("Document", "doc1", title="Doc1", description="Description of Döc1.")]
    doc1.reindexObject()
    doc2 = portal[portal.invokeFactory("Document", "doc2", title="Döc2", description="Description of Döc2.")]
    doc2.reindexObject()

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    user2 = 'test_user_2_'
    regtool = getToolByName(portal, 'portal_registration')
    regtool.addMember(user2, user2)
    setRoles(portal, user2, ['Editor'])
    self.globs['user2'] = user2

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    portal_url = portal.absolute_url()
    browser.setBaseUrl(portal_url)

    self.globs['controlpanel_url'] = '{0}/@@overview-controlpanel'.format(portal_url)

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    image_file = open(os.path.join(os.path.dirname(__file__), 'image', 'image.png'), 'rb')

    # Creat Image.
    image = portal[portal.invokeFactory('Image', 'picture', image='image.png')]
    image.setImage(image_file)
    self.globs['image_url'] = '{0}/view'.format(image.absolute_url())

    # Create News.
    news = portal[portal.invokeFactory('News Item', 'news', title='News')]
    news.setImage(image_file)
    self.globs['news_url'] = '{0}/view'.format(news.absolute_url())

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    portal = layer['portal']
    browser = Browser(layer['app'])
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })
    portal_url = portal.absolute_url()
    browser.setBaseUrl(portal_url)

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    self.globs['controlpanel_url'] = '{}/@@overview-controlpanel'.format(portal_url)

    folder01 = portal[
        portal.invokeFactory(
            'Folder',
            'folder01',
            subject=('Täg01', 'Tög02', 'Tåg03'),
        )
    ]
    folder01.reindexObject()

    transaction.commit()
Esempio n. 27
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'portal': portal,
        'browser': browser,
    })
    ztc.utils.setupCoreSessions(layer['app'])
    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    # Set the site back in English mode to make testing easier.
    portal.portal_languages.manage_setLanguageSettings('en', ['en', 'fi'])

    workflow = getToolByName(portal, 'portal_workflow')

    # Add two shipping method
    shipping_method_container = portal['toimitustavat']
    shipping_method1 = shipping_method_container[shipping_method_container.invokeFactory('ShippingMethod', 'shippingmethod1',
        title='ShippingMethöd1', vat=24.0)]
    modified(shipping_method1)
    workflow.doActionFor(shipping_method1, 'publish')
    shipping_method2 = shipping_method_container[shipping_method_container.invokeFactory('ShippingMethod', 'shippingmethod2',
        title='ShippingMethöd2', vat=24.0)]
    modified(shipping_method2)
    workflow.doActionFor(shipping_method2, 'publish')

    regtool = getToolByName(portal, 'portal_registration')
    regtool.addMember('member1', 'member1')
    setRoles(portal, 'member1', ['Member'])

    # ## Setup MockMailHost
    from Products.CMFPlone.tests.utils import MockMailHost
    from Products.MailHost.interfaces import IMailHost
    from zope.component import getSiteManager
    portal._original_MailHost = portal.MailHost
    portal.MailHost = mailhost = MockMailHost('MailHost')
    sm = getSiteManager(context=portal)
    sm.unregisterUtility(provided=IMailHost)
    sm.registerUtility(mailhost, provided=IMailHost)
    self.globs.update({
        'mailhost': portal.MailHost,
        # 'prink': prink,
    })

    transaction.commit()
Esempio n. 28
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })
    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    folder = portal[portal.invokeFactory('Folder', 'folder', title='Folder',
        description="Description of Folder")]
    folder.reindexObject()
    self.globs['folder_url'] = folder.absolute_url()

    ids = [1, 2]
    for oid in ids:
        obj = folder[
            folder.invokeFactory(
                'Event',
                'event0{0}'.format(oid),
                title='Event0{0}'.format(oid),
                description='Description of Event0{0}'.format(oid),
                startDate=DateTime() + oid - 1,
                endDate=DateTime() + oid,
            )
        ]
        obj.reindexObject()
    event03 = folder[
        folder.invokeFactory(
            'Event',
            'event03',
            title='Event03',
            description='Description of Event03',
            startDate=DateTime('2012/5/6 10:30:00 am'),
            endDate=DateTime('2012/5/6 11:50:00 am'),
        )
    ]
    event03.reindexObject()

    user2 = 'test_user_2_'
    regtool = getToolByName(portal, 'portal_registration')
    regtool.addMember(user2, user2)
    setRoles(portal, user2, ['Site Administrator'])
    self.globs['user2'] = user2

    transaction.commit()
Esempio n. 29
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })
    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    folder = portal[portal.invokeFactory('Folder',
                                         'folder',
                                         title='Folder',
                                         description="Description of Folder")]
    folder.reindexObject()
    self.globs['folder_url'] = folder.absolute_url()

    ids = [1, 2]
    for oid in ids:
        obj = folder[folder.invokeFactory(
            'Event',
            'event0{0}'.format(oid),
            title='Event0{0}'.format(oid),
            description='Description of Event0{0}'.format(oid),
            startDate=DateTime() + oid - 1,
            endDate=DateTime() + oid,
        )]
        obj.reindexObject()
    event03 = folder[folder.invokeFactory(
        'Event',
        'event03',
        title='Event03',
        description='Description of Event03',
        startDate=DateTime('2012/5/6 10:30:00 am'),
        endDate=DateTime('2012/5/6 11:50:00 am'),
    )]
    event03.reindexObject()

    user2 = 'test_user_2_'
    regtool = getToolByName(portal, 'portal_registration')
    regtool.addMember(user2, user2)
    setRoles(portal, user2, ['Site Administrator'])
    self.globs['user2'] = user2

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Site Administrator'])
    # setRoles(portal, TEST_USER_ID, ['Manager'])

    user2 = 'test_user_2_'
    regtool = getToolByName(portal, 'portal_registration')
    regtool.addMember(user2, user2)
    setRoles(portal, user2, ['Contributor'])
    self.globs['user2'] = user2

    folder1 = portal[portal.invokeFactory('Folder', 'folder1', title="Földer1")]
    # INavigationRoot for folder1.
    alsoProvides(folder1, INavigationRoot)
    folder1.reindexObject()
    folder2 = portal[portal.invokeFactory('Folder', 'folder2', title="Földer2")]
    # INavigationRoot for folder2.
    alsoProvides(folder1, INavigationRoot)
    folder2.reindexObject()
    doc1 = folder1[folder1.invokeFactory(
        'Document', 'doc1', title="Döcument1", description="Description of Döcument1")]
    doc1.setEffectiveDate(doc1.modified())
    doc1.reindexObject()
    desc = 'Ä' * 201
    doc2 = folder2[folder2.invokeFactory(
        'Document', 'doc2', title="Döcument2", description=desc)]
    doc2.setEffectiveDate(doc2.modified())
    doc2.reindexObject()

    ajankohtaista = portal[portal.invokeFactory('Folder', 'ajankohtaista', title="Ajankohtaista")]
    ajankohtaista.setEffectiveDate(ajankohtaista.modified())
    ajankohtaista.reindexObject()

    news1 = ajankohtaista[ajankohtaista.invokeFactory(
        'News Item', 'news1', title="News1", description="Descriptiön of News1")]
    # news1.setEffectiveDate(news1.modified())
    news1.reindexObject()

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
        'prink': prink,
    })
    ztc.utils.setupCoreSessions(layer['app'])
    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    regtool = getToolByName(portal, 'portal_registration')

    member1 = 'member1'
    regtool.addMember(member1, member1)
    setRoles(portal, member1, ['Member'])
    self.globs['member1'] = member1

    member2 = 'member2'
    regtool.addMember(member2, member2)
    setRoles(portal, member2, ['Member'])
    self.globs['member2'] = member2

    self.globs['today'] = date.today()

    portal.manage_changeProperties(
        email_from_address='*****@*****.**', email_from_name='Email From Name')

    # ## Setup MockMailHost
    from Products.CMFPlone.tests.utils import MockMailHost
    from Products.MailHost.interfaces import IMailHost
    from zope.component import getSiteManager
    portal._original_MailHost = portal.MailHost
    portal.MailHost = mailhost = MockMailHost('MailHost')
    sm = getSiteManager(context=portal)
    sm.unregisterUtility(provided=IMailHost)
    sm.registerUtility(mailhost, provided=IMailHost)
    self.globs.update({
        'mailhost': portal.MailHost,
    })

    transaction.commit()
Esempio n. 32
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
    })
    portal = layer['portal']
    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    transaction.commit()
Esempio n. 33
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
    })
    portal = layer['portal']
    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })
    ztc.utils.setupCoreSessions(layer['app'])
    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    transaction.commit()
Esempio n. 35
0
def setUp(self):
    layer = self.globs['layer']
    portal = layer['portal']
    app = layer['app']
    browser = Browser(app)
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })
    ztc.utils.setupCoreSessions(app)
    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    alsoProvides(portal, IShoppingSiteRoot)

    # Add two members
    regtool = getToolByName(portal, 'portal_registration')

    member1 = 'member1'
    regtool.addMember(member1, member1)
    setRoles(portal, member1, ['Member'])

    member2 = 'member2'
    regtool.addMember(member2, member2)
    setRoles(portal, member2, ['Member'])

    member3 = 'member3'
    regtool.addMember(member3, member3)
    setRoles(portal, member3, ['Member'])

    member4 = 'member4'
    regtool.addMember(member4, member4)
    setRoles(portal, member4, ['Member', 'Site Administrator'])

    membership = getToolByName(portal, 'portal_membership')
    member2 = membership.getMemberById('member2')
    member2.setMemberProperties({'allow_direct_marketing': True, 'email': '*****@*****.**', 'fullname': 'Full Name 2'})
    member3 = membership.getMemberById('member3')
    member3.setMemberProperties({'allow_direct_marketing': True, 'email': '*****@*****.**', 'fullname': 'Full Name 3'})

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    app = layer['app']
    browser = Browser(app)
    portal = layer['portal']

    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    ztc.utils.setupCoreSessions(app)
    wftool = getToolByName(portal, 'portal_workflow')
    portal.invokeFactory(
        'FormFolder',
        'form01',
        title="Form01",
        thanksPageOverride='traverse_to:string:form02',
    )
    form01 = portal.form01
    form01.actionAdapter = ()
    wftool.doActionFor(form01, "publish")
    form01.reindexObject()
    portal.invokeFactory(
        'FormFolder',
        'form02',
        title="Form02",
        thanksPageOverride='traverse_to:string:form2',
    )
    form02 = portal.form02
    wftool.doActionFor(form02, "publish")
    form02.reindexObject()
    del form02['thank-you']
    del form02['mailer']

    transaction.commit()
Esempio n. 37
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })
    ztc.utils.setupCoreSessions(layer['app'])
    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'portal': portal,
        'browser': browser,
    })
    ztc.utils.setupCoreSessions(layer['app'])
    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    # Set the site back in English mode to make testing easier.
    portal.portal_languages.manage_setLanguageSettings('en', ['en', 'fi'])

    # Set title and description for the plone site.
    portal.manage_changeProperties(title='Luonnonsuojelukauppa', description='Suomen Luonnonsuojelun Tuki Oy')

    # Make portal shipping site.
    from collective.cart.core.interfaces import IShoppingSiteRoot
    from zope.interface import alsoProvides
    alsoProvides(portal, IShoppingSiteRoot)
    portal.reindexObject(idxs=['object_provides'])

    from plone.dexterity.utils import createContentInContainer
    from zope.lifecycleevent import modified

    container = createContentInContainer(portal, 'collective.cart.core.CartContainer',
        id='cart-container', title='Cart Container', checkConstraints=False)
    modified(container)

    container = createContentInContainer(portal, 'collective.cart.shipping.ShippingMethodContainer',
        id='shipping-methods', title=u'Shipping Methods', checkConstraints=False)
    modified(container)

    transaction.commit()
Esempio n. 39
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
    })

    portal = layer['portal']
    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    # Set the site back in English mode to make testing easier.
    portal.portal_languages.manage_setLanguageSettings('en', ['en', 'ja'])

    transaction.commit()
Esempio n. 40
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
    })

    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    # Create Földer
    folder = portal[portal.invokeFactory('Folder', 'folder', title="Földer", description="Description of Földer")]
    folder.reindexObject()

    transaction.commit()
Esempio n. 41
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    # Update global variables within the tests.
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
    })

    portal = layer['portal']
    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    # Set the site back in English mode to make testing easier.
    portal.portal_languages.manage_setLanguageSettings('en', ['en', 'ja'])

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })
    ztc.utils.setupCoreSessions(layer['app'])
    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    # Remove front-page
    portal.manage_delObjects(['front-page'])

    folder01 = portal[
        portal.invokeFactory(
            'Folder',
            'folder01',
            title='Folder01'
        )]
    folder01.reindexObject()

    regtool = getToolByName(portal, 'portal_registration')

    member1 = 'member1'
    regtool.addMember(member1, member1)
    setRoles(portal, member1, ['Member'])
    self.globs['member1'] = member1

    member2 = 'member2'
    regtool.addMember(member2, member2)
    setRoles(portal, member2, ['Member'])
    self.globs['member2'] = member2

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    portal = layer['portal']
    browser = Browser(layer['app'])

    current_year = DateTime().year()
    next_year = str(current_year + 1)
    next_next_year = str(current_year + 2)
    current_year = str(current_year)

    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'current_year': current_year,
        'next_next_year': next_next_year,
        'next_year': next_year,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    self.globs['controlpanel_url'] = '{}/@@overview-controlpanel'.format(portal.absolute_url())

    folder = portal[
        portal.invokeFactory(
            'Folder',
            'folder',
            title='Földer',
        )
    ]
    folder.reindexObject()

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    portal = layer['portal']
    browser = Browser(layer['app'])
    self.globs.update({
        'portal': portal,
        'browser': browser,
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
    })
    ztc.utils.setupCoreSessions(layer['app'])
    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    basic = 'Basic {0}:{1}'.format(TEST_USER_NAME, TEST_USER_PASSWORD)
    browser.setHeader('Authorization', basic)

    # Create Form Folder
    portal.invokeFactory(
        'FormFolder',
        'form',
        title="Form Folder")
    form = portal.form
    form_url = form.absolute_url()
    self.globs.update({
        'form': form,
        'form_url': form_url,
    })
    for key in form.keys():
        del form[key]
    form.thanksPage = ''
    form.reindexObject()

    transaction.commit()
Esempio n. 45
0
def setUp(self):
    layer = self.globs['layer']
    app = layer['app']
    browser = Browser(app)
    portal = layer['portal']

    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    ztc.utils.setupCoreSessions(app)
    portal.invokeFactory('FormFolder', 'form', title="Form Folder")
    self.globs.update({'form': portal.form})

    transaction.commit()
Esempio n. 46
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })
    ztc.utils.setupCoreSessions(layer['app'])
    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    regtool = getToolByName(portal, 'portal_registration')

    member1 = 'member1'
    regtool.addMember(member1, member1)
    setRoles(portal, member1, ['Member'])
    self.globs['member1'] = member1

    member2 = 'member2'
    regtool.addMember(member2, member2)
    setRoles(portal, member2, ['Member'])
    member = getToolByName(portal,
                           'portal_membership').getMemberById('member2')
    member.setMemberProperties({'registration_number': 'RN'})
    self.globs['member2'] = member2

    self.globs['today'] = date.today()

    transaction.commit()
Esempio n. 47
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']
    # Update global variables within the tests.
    self.globs.update({
        'browser': browser,
        'portal': portal,
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
    })

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    data_path = '/'.join(__file__.split('/')[:-1] + ['files', 'data.csv'])
    self.globs['data_path'] = data_path
    self.globs['data_file'] = open(data_path)

    transaction.commit()
Esempio n. 48
0
def setUp(self):
    layer = self.globs['layer']
    app = layer['app']
    browser = Browser(app)
    portal = layer['portal']

    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
        'prink': prink,
    })

    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    ztc.utils.setupCoreSessions(app)

    portal._original_MailHost = portal.MailHost
    portal.MailHost = mailhost = MockMailHost('MailHost')
    sm = getSiteManager(context=portal)
    sm.unregisterUtility(provided=IMailHost)
    sm.registerUtility(mailhost, provided=IMailHost)

    self.globs.update({'mailhost': mailhost})

    properties = getToolByName(portal, 'portal_properties')
    pp = getattr(properties, 'collective_pfg_payment_properties')
    IProperties(pp).mac = '6pKF4jkv97zmqBJ3ZL8gUw5DfT2NMQ'
    IProperties(pp).fields = [
        'MERCHANT_ID',
        'AMOUNT',
        'ORDER_NUMBER',
        'REFERENCE_NUMBER',
        'ORDER_DESCRIPTION',
        'CURRENCY',
        'RETURN_ADDRESS',
        'CANCEL_ADDRESS',
        'PENDING_ADDRESS',
        'NOTIFY_ADDRESS',
        'TYPE',
        'CULTURE',
        'PRESELECTED_METHOD',
        'MODE',
        'VISIBLE_METHODS',
        'GROUP',
    ]
    IProperties(pp).separator = '|'
    IProperties(pp).capital = True
    ## Tools
    wftool = getToolByName(portal, 'portal_workflow')
    ## Create Starting Form Folder
    portal.invokeFactory(
        'FormFolder',
        'start_form',
        title="Start Form Folder",
    )
    start_form = portal.start_form
    start_form.setActionAdapter(())
    start_form.setThanksPageOverride('traverse_to:string:form')
    wftool.doActionFor(start_form, "publish")
    ## Add FormFixedPointField
    start_form.invokeFactory(
        'FormFixedPointField',
        'AMOUNT',
        title='Price',
        required=True,
    )
    ## Create Form Folder
    portal.invokeFactory(
        'FormFolder',
        'form',
        title="Form Folder",
    )
    form = portal.form
    form.setActionAdapter(())
    url = '%s/@@test-payment-interface' % portal.absolute_url()
    form.setFormActionOverride(url)
    wftool.doActionFor(form, "publish")
    ## Add FormFixedPointField
    form.invokeFactory(
        'FormStringField',
        'MERCHANT_ID',
        fgDefault='13466',
    )
    form.invokeFactory(
        'FormStringField',
        'AMOUNT',
        fgDefault='1',
    )
    form.invokeFactory(
        'FormStringField',
        'ORDER_NUMBER',
        fgDefault='1',
        fgTDefault='python:here.restrictedTraverse("number")()',
    )
    form.invokeFactory(
        'FormStringField',
        'REFERENCE_NUMBER',
        fgDefault='',
    )
    form.invokeFactory(
        'FormStringField',
        'ORDER_DESCRIPTION',
        fgDefault='[email protected],t,t,1',
    )
    form.invokeFactory(
        'FormStringField',
        'CURRENCY',
        fgDefault='EUR',
    )
    form.invokeFactory(
        'FormStringField',
        'RETURN_ADDRESS',
        fgDefault=
        'http://*****:*****@@verkkomaksut-success',
    )
    form.invokeFactory(
        'FormStringField',
        'CANCEL_ADDRESS',
        fgDefault=
        'http://*****:*****@@verkkomaksut-canceled',
    )
    form.invokeFactory(
        'FormStringField',
        'PENDING_ADDRESS',
        fgDefault='',
    )
    form.invokeFactory(
        'FormStringField',
        'NOTIFY_ADDRESS',
        fgDefault=
        'http://*****:*****@@verkkomaksut-notify',
    )
    form.invokeFactory(
        'FormStringField',
        'TYPE',
        fgDefault='S1',
    )
    form.invokeFactory(
        'FormStringField',
        'CULTURE',
        fgDefault='fi_FI',
    )
    form.invokeFactory(
        'FormStringField',
        'PRESELECTED_METHOD',
        fgDefault='',
    )
    form.invokeFactory(
        'FormStringField',
        'MODE',
        fgDefault='1',
    )
    form.invokeFactory(
        'FormStringField',
        'VISIBLE_METHODS',
        fgDefault='',
    )
    form.invokeFactory(
        'FormStringField',
        'GROUP',
        fgDefault='',
    )
    form.invokeFactory(
        'FormStringField',
        'AUTHCODE',
        fgTDefault='python:here.restrictedTraverse("auth-code")',
    )
    ## Create script adapter to put fields to session.
    form.invokeFactory(
        'FormCustomScriptAdapter',
        'script_adapter',
        ScriptBody=
        'items = dict(AMOUNT=request.form["AMOUNT"],)\nrequest.SESSION.set("collective.pfg.payment", items)'
    )
    ## Create Final Form Folder
    portal.invokeFactory(
        'FormFolder',
        'final_form',
        title="Final Form Folder",
    )
    final_form = portal.final_form
    wftool.doActionFor(final_form, "publish")
    mailer = final_form['mailer']
    mailer.setRecipient_email('*****@*****.**')

    transaction.commit()
def setUp(self):
    layer = self.globs['layer']
    portal = layer['portal']
    browser = Browser(layer['app'])
    self.globs.update({
        'portal': portal,
        'browser': browser,
        'prink': prink,
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
    })
    ztc.utils.setupCoreSessions(layer['app'])
    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    basic = 'Basic {}:{}'.format(TEST_USER_NAME, TEST_USER_PASSWORD)
    browser.setHeader('Authorization', basic)

    # ## Setup MockMailHost
    from Products.CMFPlone.tests.utils import MockMailHost
    from Products.MailHost.interfaces import IMailHost
    from zope.component import getSiteManager
    portal._original_MailHost = portal.MailHost
    portal.MailHost = mailhost = MockMailHost('MailHost')
    sm = getSiteManager(context=portal)
    sm.unregisterUtility(provided=IMailHost)
    sm.registerUtility(mailhost, provided=IMailHost)
    self.globs.update({
        'mailhost': portal.MailHost,
    })

    # Create Form Folder
    portal.invokeFactory('FormFolder', 'form', title="Form Folder")
    form = portal.form
    form_url = form.absolute_url()
    self.globs.update({
        'form': form,
        'form_url': form_url,
    })
    form.invokeFactory('PFGExtendedMailAdapter',
                       'adapter',
                       title='Verkkomaksut Adapter',
                       recipient_email='*****@*****.**')
    adapter = form.adapter
    adapter_url = adapter.absolute_url()
    self.globs.update({
        'adapter': adapter,
        'adapter_url': adapter_url,
    })
    form.setActionAdapter(('adapter', ))
    ## Add Image and File under adapter
    dummy_image = io.StringIO('Dummy Image')
    adapter.invokeFactory('Image',
                          'dummy_image',
                          title='dummy.gif',
                          image_file=dummy_image)
    dummy_image = adapter['dummy_image']
    dimage_uid = dummy_image.UID()
    dummy_file = io.StringIO('Dummy File')
    adapter.invokeFactory('File',
                          'dummy_file',
                          title='dummy.pdf',
                          file_file=dummy_file)
    dummy_file = adapter['dummy_file']
    dfile_uid = dummy_file.UID()
    self.globs.update({
        'dummy_image': dummy_image,
        'dimage_uid': dimage_uid,
        'dummy_file': dummy_file,
        'dfile_uid': dfile_uid,
    })

    transaction.commit()
Esempio n. 50
0
def setUp(self):
    layer = self.globs['layer']
    browser = Browser(layer['app'])
    portal = layer['portal']

    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())

    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()

    setRoles(portal, TEST_USER_ID, ['Manager'])

    ## Set title and description of foundation
    foundation = portal[portal.invokeFactory(
        'Folder',
        'foundation',
        language='',
    )]
    foundation.setLayout('santa-view')
    foundation.reindexObject()
    en = foundation[foundation.invokeFactory(
        'Document',
        'en',
        title='Santa Claus Foundation',
        description='Save the world for kids',
        text='<p>Text of SCF.</p>',
    )]
    en.reindexObject()

    # Create Inquiries Folder.
    inquiries = portal[portal.invokeFactory(
        'Folder',
        'inquiries',
        title='Inquiries',
        description='Description of Inquiries.',
        language='',
    )]
    inquiries.setLayout('santa-view')
    inquiries.reindexObject()

    en = inquiries[inquiries.invokeFactory(
        'Document',
        'en',
        title='English Inquiries',
        description='Description of English Inquiries.',
        text='<p>Text of English Inquiries.</p>',
    )]
    en.reindexObject()

    # Add two forms which link comes to top page.
    form01 = inquiries[inquiries.invokeFactory(
        'FormFolder',
        'form01',
        title='Form01',
        description='Description of Form01.',
    )]
    form01.reindexObject()

    form02 = inquiries[inquiries.invokeFactory(
        'FormFolder',
        'form02',
        title='Form02',
        description='Description of Form02.',
    )]
    form02.reindexObject()

    # Add News folder and two News Items.
    news = portal[portal.invokeFactory(
        'Folder',
        'news',
        title="News",
        language='',
    )]
    news.setLayout('santa-view')
    news.reindexObject()
    news01 = news[news.invokeFactory('News Item',
                                     'news01',
                                     title="News01",
                                     description="Description of News01.")]
    news01.reindexObject()
    news02 = news[news.invokeFactory('News Item',
                                     'news02',
                                     title="News02",
                                     description="Description of News02.")]
    news02.reindexObject()

    # Add Events folder and two Events.
    events = portal[portal.invokeFactory(
        'Folder',
        'events',
        title="Events",
        language='',
    )]
    events.setLayout('santa-view')
    events.reindexObject()
    now = DateTime()
    event01 = events[events.invokeFactory(
        'Event',
        'event01',
        title="Event01",
        description="Description of Event01.",
        startDate=now - 3,
        endDate=now - 2,
    )]
    event01.reindexObject()
    event02 = events[events.invokeFactory(
        'Event',
        'event02',
        title="Event02",
        description="Description of Event02.",
        startDate=now - 1,
        endDate=now,
    )]
    event02.reindexObject()
    event03 = events[events.invokeFactory(
        'Event',
        'event03',
        title="Event03",
        description="Description of Event03.",
        startDate=now + 1,
        endDate=now + 2,
    )]
    event03.reindexObject()
    event04 = events[events.invokeFactory(
        'Event',
        'event04',
        title="Event04",
        description="Description of Event04.",
        startDate=now + 3,
        endDate=now + 4,
    )]
    event04.reindexObject()

    # Add Partners folder and two partners.
    partners = portal[portal.invokeFactory(
        'Folder',
        'partners',
        title="Partners",
        language='',
    )]
    partners.setLayout('santa-view')
    partners.reindexObject()
    partner01 = partners[partners.invokeFactory(
        'santa.Partner',
        'partner01',
        title="Partner01",
        description="Description of Partner01.",
        address='Street Address of Partner01',
        post_code='010101',
        country='fi',
        email=['*****@*****.**'],
        year='2011',
    )]
    partner01.reindexObject()
    partner02 = partners[partners.invokeFactory(
        'santa.Partner',
        'partner02',
        title="Partner02",
        description="Description of Partner02.",
        address='Street Address of Partner02',
        post_code='020202',
        country='ja',
        email=['*****@*****.**'],
        year='2012',
    )]
    partner02.reindexObject()

    # Add Cases Folder and Images under partner01.
    cases = portal[portal.invokeFactory(
        'Folder',
        'cases',
        title="Cases",
        language='',
    )]
    cases.setLayout('santa-view')
    cases.reindexObject()

    image01 = partner01[partner01.invokeFactory(
        'Image',
        'image01',
        title="Image01",
        description="Description of Imager01.",
    )]
    image01.reindexObject()
    image02 = partner01[partner01.invokeFactory(
        'Image',
        'image02',
        title="Image02",
        description="Description of Imager02.",
    )]
    image02.reindexObject()

    transaction.commit()
Esempio n. 51
0
def setUp(self):
    layer = self.globs['layer']
    app = layer['app']
    browser = Browser(app)
    portal = layer['portal']

    self.globs.update({
        'TEST_USER_NAME': TEST_USER_NAME,
        'TEST_USER_PASSWORD': TEST_USER_PASSWORD,
        'browser': browser,
        'portal': portal,
    })

    browser.setBaseUrl(portal.absolute_url())
    browser.handleErrors = True
    portal.error_log._ignored_exceptions = ()
    setRoles(portal, TEST_USER_ID, ['Manager'])

    ztc.utils.setupCoreSessions(app)
    properties = getToolByName(portal, 'portal_properties')
    pp = getattr(properties, 'collective_pfg_payment_properties')
    IProperties(pp).mac = '6pKF4jkv97zmqBJ3ZL8gUw5DfT2NMQ'
    IProperties(pp).fields = [
        'MERCHANT_ID',
        'AMOUNT',
        'ORDER_NUMBER',
        'REFERENCE_NUMBER',
        'ORDER_DESCRIPTION',
        'CURRENCY',
        'RETURN_ADDRESS',
        'CANCEL_ADDRESS',
        'PENDING_ADDRESS',
        'NOTIFY_ADDRESS',
        'TYPE',
        'CULTURE',
        'PRESELECTED_METHOD',
        'MODE',
        'VISIBLE_METHODS',
        'GROUP',
    ]
    IProperties(pp).separator = '|'
    IProperties(pp).capital = True
    ## Tools
    wftool = getToolByName(portal, 'portal_workflow')
    ## Create Starting Form Folder
    portal.invokeFactory(
        'FormFolder',
        'start_form',
        title="Start Form Folder",
    )
    start_form = portal.start_form
    wftool.doActionFor(start_form, "publish")
    ## Create Form Folder
    portal.invokeFactory(
        'FormFolder',
        'form',
        title="Form Folder",
    )
    form = portal.form
    wftool.doActionFor(form, "publish")
    ## Add FormFixedPointField
    form.invokeFactory(
        'FormStringField',
        'MERCHANT_ID',
        fgDefault='13466',
    )
    form.invokeFactory(
        'FormStringField',
        'AMOUNT',
        fgDefault='1',
    )
    form.invokeFactory(
        'FormStringField',
        'ORDER_NUMBER',
        fgDefault='1',
    )
    form.invokeFactory(
        'FormStringField',
        'REFERENCE_NUMBER',
        fgDefault='',
    )
    form.invokeFactory(
        'FormStringField',
        'ORDER_DESCRIPTION ',
        fgDefault='[email protected],t,t,1',
    )
    form.invokeFactory(
        'FormStringField',
        'CURRENCY ',
        fgDefault='EUR',
    )
    form.invokeFactory(
        'FormStringField',
        'RETURN_ADDRESS',
        fgDefault=
        'http://*****:*****@@verkkomaksut-success',
    )
    form.invokeFactory(
        'FormStringField',
        'CANCEL_ADDRESS ',
        fgDefault=
        'http://*****:*****@@verkkomaksut-canceled',
    )
    form.invokeFactory(
        'FormStringField',
        'PENDING_ADDRESS ',
        fgDefault='',
    )
    form.invokeFactory(
        'FormStringField',
        'NOTIFY_ADDRESS',
        fgDefault=
        'http://*****:*****@@verkkomaksut-notify',
    )
    form.invokeFactory(
        'FormStringField',
        'TYPE',
        fgDefault='S1',
    )
    form.invokeFactory(
        'FormStringField',
        'CULTURE',
        fgDefault='fi_FI',
    )
    form.invokeFactory(
        'FormStringField',
        'PRESELECTED_METHOD ',
        fgDefault='',
    )
    form.invokeFactory(
        'FormStringField',
        'MODE',
        fgDefault='1',
    )
    form.invokeFactory(
        'FormStringField',
        'VISIBLE_METHODS ',
        fgDefault='',
    )
    form.invokeFactory(
        'FormStringField',
        'GROUP',
        fgDefault='',
    )
    form.invokeFactory(
        'FormStringField',
        'AUTHCODE',
        fgTDefault='python:here.restrictedTraverse("auth-code")',
    )

    transaction.commit()