當前位置: 首頁>>代碼示例>>Python>>正文


Python Browser.setBaseUrl方法代碼示例

本文整理匯總了Python中hexagonit.testing.browser.Browser.setBaseUrl方法的典型用法代碼示例。如果您正苦於以下問題:Python Browser.setBaseUrl方法的具體用法?Python Browser.setBaseUrl怎麽用?Python Browser.setBaseUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hexagonit.testing.browser.Browser的用法示例。


在下文中一共展示了Browser.setBaseUrl方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:taito,項目名稱:sll.policy,代碼行數:27,代碼來源:test_functional.py

示例2: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:collective,項目名稱:Products.PloneGazette,代碼行數:29,代碼來源:test_spam.py

示例3: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:collective,項目名稱:collective.cart.core,代碼行數:29,代碼來源:test_ValidateOrderIDUniqueness.py

示例4: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:collective,項目名稱:collective.cropimage,代碼行數:37,代碼來源:test_functional.py

示例5: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:taito,項目名稱:collective.pfg.showrequest,代碼行數:37,代碼來源:test_functional.py

示例6: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:collective,項目名稱:collective.searchevent,代碼行數:32,代碼來源:test_registry.py

示例7: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:taito,項目名稱:sll.basetheme,代碼行數:33,代碼來源:test_functional.py

示例8: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:taito,項目名稱:slt.content,代碼行數:37,代碼來源:test_functional.py

示例9: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:collective,項目名稱:Products.PloneGazette,代碼行數:28,代碼來源:test_functional.py

示例10: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:collective,項目名稱:collective.microsite,代碼行數:27,代碼來源:test_functional.py

示例11: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:hexagonit,項目名稱:hexagonit.portletroles,代碼行數:28,代碼來源:test_functional.py

示例12: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:taito,項目名稱:slt.portlet,代碼行數:30,代碼來源:test_functional.py

示例13: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:hexagonit,項目名稱:Products.Ploneboard,代碼行數:32,代碼來源:testFunctional.py

示例14: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:collective,項目名稱:collective.portlet.contentsearch,代碼行數:29,代碼來源:test_functional.py

示例15: setUp

# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setBaseUrl [as 別名]
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()
開發者ID:taito,項目名稱:slt.theme,代碼行數:31,代碼來源:test_functional.py


注:本文中的hexagonit.testing.browser.Browser.setBaseUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。