本文整理匯總了Python中hexagonit.testing.browser.Browser.setHeader方法的典型用法代碼示例。如果您正苦於以下問題:Python Browser.setHeader方法的具體用法?Python Browser.setHeader怎麽用?Python Browser.setHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類hexagonit.testing.browser.Browser
的用法示例。
在下文中一共展示了Browser.setHeader方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setUp
# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setHeader [as 別名]
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()
示例2: setUp
# 需要導入模塊: from hexagonit.testing.browser import Browser [as 別名]
# 或者: from hexagonit.testing.browser.Browser import setHeader [as 別名]
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='[email protected]')
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 = StringIO.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 = StringIO.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()