本文整理汇总了Python中hexagonit.testing.browser.Browser类的典型用法代码示例。如果您正苦于以下问题:Python Browser类的具体用法?Python Browser怎么用?Python Browser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Browser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
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()
示例2: setUp
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()
示例3: setUp
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()
示例4: setUp
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()
示例5: setUp
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()
示例6: setUp
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()
示例7: setUp
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()
示例8: setUp
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()
示例9: setUp
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()
示例10: setUp
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()
示例11: setUp
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()
示例12: setUp
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()
示例13: setUp
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()
示例14: setUp
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()
示例15: setUp
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()