本文整理汇总了Python中twill.execute_string函数的典型用法代码示例。如果您正苦于以下问题:Python execute_string函数的具体用法?Python execute_string怎么用?Python execute_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了execute_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: search_tes
def search_tes(self):
''' Search tests:'''
# copied from twilltests/files/files-tests.tsuite
mytwilltests = [
"login 'admin'",
# Search tests
# Test searching for a blog entry
"runfile '${test_path}/search/search_blog_entry.twill'",
# Test searching for a calendar entry
"runfile '${test_path}/search/search_calendar_entry.twill'",
# Test searching for a community
"runfile '${test_path}/search/search_community.twill'",
# Test searching for a file
"runfile '${test_path}/search/search_file.twill'",
# Test searching for a user
"runfile '${test_path}/search/search_user.twill'",
# Test searching for wiki
"runfile '${test_path}/search/search_wiki_entry.twill'",
]
for comm in mytwilltests:
twill.execute_string(comm)
开发者ID:Falmarri,项目名称:karl,代码行数:31,代码来源:test_twill_wsgi.py
示例2: test_sso_defederate_then_slo
def test_sso_defederate_then_slo():
twill.commands.reset_browser()
twill.execute_string('''
go http://localhost:10002
submit
fv 1 username fred
fv 1 password fred
submit
url http://localhost:10002
submit fedterm-soap
url http://localhost:10002
notfind 'Log on'
find 'Single Logout'
notfind 'Federation Termination'
go http://localhost:10001
find 'Local Logout'
find 'Single Logout'
notfind 'Federation Termination'
fv 2 binding SOAP
fv 2 slo 'Single Logout'
submit 'Single Logout'
url http://localhost:10001
find 'Log in'
notfind 'Single Logout'
notfind 'Federation termination'
go http://localhost:10002
find 'Log on'
notfind 'Single Logout'
notfind 'Federation termination'
''')
开发者ID:adieu,项目名称:lasso,代码行数:30,代码来源:test_03_defederation.py
示例3: do_cleanup_for
def do_cleanup_for(name):
if has_cleanup_handler(name) and not options.no_cleanup_mode:
log_info("running cleanup handler for %s" % name)
try:
suite_data = file(current_namespace[-1].cleanup[name]).read()
calls = parse_suite(suite_data)
for script,args,line in calls:
try:
if current_namespace[-1].suites.get(script):
log_warn("Cannot call sub-suite %s during cleanup at %s(%d)" % (script,name,line))
else:
log_info("running cleanup: %s" % name)
script_data = read_test(script)
try:
parameters = make_dict_from_call(args,get_twill_glocals()[0])
except (ValueError, TypeError, SyntaxError), e:
e.args = ("\"%s%s\": Only positional argument passing is supported in suites." % \
(name, args), ) + e.args[1:]
raise e
script_data = make_twill_local_defs(parameters) + script_data
twill.execute_string(script_data, no_reset=1)
except Exception, e:
maybe_print_stack()
log_warn("Cleanup call to %s failed at %s(%d)"
% (script + args, name + CLEANUP, line))
except IOError,e:
maybe_print_stack()
log_warn("Unable to read cleanup handler for %s" % name)
except Exception,e:
maybe_print_stack()
log_warn("Exception during cleanup handler for %s" % name)
开发者ID:SMFOSS,项目名称:flunc,代码行数:31,代码来源:flunc.py
示例4: tagging_tes
def tagging_tes(self):
''' Tagging tests:'''
# copied from twilltests/files/files-tests.tsuite
mytwilltests = [
"login 'admin'",
# Tag suite
# tag a community
"runfile '${test_path}/tagging/tag_community.twill'",
# tag a blog entry
#"runfile '${test_path}/tagging/tag_blog_entry.twill'",
# tag a calendar entry
"runfile '${test_path}/tagging/tag_calendar_entry.twill'",
# tag a file
"runfile '${test_path}/tagging/tag_file.twill'",
# tag a user
"runfile '${test_path}/tagging/tag_user.twill'",
# tag a wiki
"runfile '${test_path}/tagging/tag_wiki_entry.twill'",
]
for comm in mytwilltests:
twill.execute_string(comm)
开发者ID:Falmarri,项目名称:karl,代码行数:30,代码来源:test_twill_wsgi.py
示例5: test_config_authentic
def test_config_authentic():
'''Setting up Authentic metadata'''
twill.execute_string('''
go http://localhost:10001/admin/settings/idp
formfile 1 privatekey private-key.pem
formfile 1 publickey public-key.pem
submit''')
开发者ID:adieu,项目名称:lasso,代码行数:7,代码来源:test_00_config.py
示例6: test_config_lcs_providers
def test_config_lcs_providers():
'''Adding Authentic as identity provider in LCS'''
twill.execute_string('''
go http://localhost:10002/admin/settings/identification/idp/idp/new_remote
showforms
fv 1 metadata_url http://localhost:10001/saml/metadata
submit
''')
开发者ID:adieu,项目名称:lasso,代码行数:8,代码来源:test_00_config.py
示例7: test_sso_ispassive
def test_sso_ispassive():
twill.commands.reset_browser()
twill.execute_string('''
go http://localhost:10002
fv 1 is_passive true
submit
url http://localhost:10002
find 'Authentication failure'
''')
开发者ID:adieu,项目名称:lasso,代码行数:9,代码来源:test_01_sso.py
示例8: test_create_users
def test_create_users():
'''Creating Authentic user'''
twill.execute_string('''
go http://localhost:10001/admin/identities/new
fv 1 name Fred
fv 1 roles$element0 Administrator
fv 1 username fred
fv 1 password fred
submit submit''')
开发者ID:adieu,项目名称:lasso,代码行数:9,代码来源:test_00_config.py
示例9: test_config_lcs
def test_config_lcs():
'''Setting up LCS metadata'''
twill.execute_string('''
go http://localhost:10002/admin/settings/identification/
fv 1 methods$elementidp true
submit
go http://localhost:10002/admin/settings/identification/idp/sp
formfile 1 privatekey private-key.pem
formfile 1 publickey public-key.pem
submit''')
开发者ID:adieu,项目名称:lasso,代码行数:10,代码来源:test_00_config.py
示例10: testIndex
def testIndex():
test = """
extend_with header
debug commands 1
go /
code 200
header charset=utf-8
"""
twill.execute_string(test, initial_url='http://localhost:4444')
开发者ID:llimllib,项目名称:cherry-blossom,代码行数:10,代码来源:test.py
示例11: testi18n
def testi18n():
test = """
debug commands 1
go /test_i18n.html
code 200
find 'I\xc3\xb1t\xc3\xabrn\xc3\xa2ti\xc3\xb4n\xc3\xa0liz\xc3\xa6ti\xc3\xb8n'
"""
twill.execute_string(test, initial_url='http://localhost:4444')
browser = twill.get_browser()
print dir(browser)
开发者ID:llimllib,项目名称:cherry-blossom,代码行数:11,代码来源:test.py
示例12: test_sso_default
def test_sso_default():
twill.commands.reset_browser()
twill.execute_string('''
go http://localhost:10002
submit
fv 1 username fred
fv 1 password fred
submit
url http://localhost:10002
find 'Logged in'
''')
开发者ID:adieu,项目名称:lasso,代码行数:11,代码来源:test_01_sso.py
示例13: test_sso_idp_initiated
def test_sso_idp_initiated():
twill.commands.reset_browser()
twill.execute_string('''
go http://localhost:10001
fv 1 username fred
fv 1 password fred
submit
fv 1 sp http-localhost-10002-saml-metadata
submit sso
url http://localhost:10002
find 'Logged in'
''')
开发者ID:adieu,项目名称:lasso,代码行数:12,代码来源:test_01_sso.py
示例14: test_config_authentic_providers
def test_config_authentic_providers():
'''Adding LCS as service provider in Authentic'''
twill.execute_string('''
go http://localhost:10001/login
fv 1 username fred
fv 1 password fred
submit
go http://localhost:10001/admin/settings/liberty_providers/new_remote
showforms
fv 1 metadata_url http://localhost:10002/saml/metadata
submit
''')
开发者ID:adieu,项目名称:lasso,代码行数:13,代码来源:test_00_config.py
示例15: load_configuration
def load_configuration(name):
filename = current_namespace[-1].conf.get(name)
if filename:
try:
configuration = read_configuration(name)
twill.execute_string(configuration, no_reset=1)
log_info("loaded configuration: %s" % (name + CONFIGURATION))
except IOError,e:
handle_exception("Unable to read configuration for suite %s" \
% (name + SUITE), e)
except Exception,e:
handle_exception("Invalid configuration: '%s'" \
% (name + CONFIGURATION), e)
开发者ID:SMFOSS,项目名称:flunc,代码行数:13,代码来源:flunc.py
示例16: blog_tes
def blog_tes(self):
''' Blog tests:'''
# copied from twilltests/blog/blog-tests.tsuite
mytwilltests = [
"login 'admin'",
# run blog tests
"runfile '${test_path}/blog/blog_view.twill'",
"runfile '${test_path}/blog/blogentry_aved.twill'",
"runfile '${test_path}/blog/blog_index.twill'",
]
for comm in mytwilltests:
twill.execute_string(comm)
开发者ID:Falmarri,项目名称:karl,代码行数:14,代码来源:test_twill_wsgi.py
示例17: wiki_tes
def wiki_tes(self):
''' Wiki tests:'''
# copied from twilltests/wiki/wiki-tests.tsuite
mytwilltests = [
"login 'admin'",
# run wiki tests
"runfile '${test_path}/wiki/wiki_view.twill'",
"runfile '${test_path}/wiki/wikipage_aved.twill'",
"runfile '${test_path}/wiki/wiki_index.twill'"
]
for comm in mytwilltests:
twill.execute_string(comm)
开发者ID:boothead,项目名称:karl,代码行数:14,代码来源:test_twill_wsgi.py
示例18: test_sso_post
def test_sso_post():
twill.commands.reset_browser()
twill.execute_string('''
go http://localhost:10002
fv 1 binding POST
submit
fv 1 username fred
fv 1 password fred
submit
find 'You should be automaticaly'
submit
url http://localhost:10002
find 'Logged in'
''')
开发者ID:adieu,项目名称:lasso,代码行数:14,代码来源:test_01_sso.py
示例19: getTicketList
def getTicketList(self, userNamePwdList):
"""This method should pass in a list [(userName, userPwd)] and will return [(userName, 普通|初级VIP|高级VIP, 用户积分(大号|小号), 日推荐票, 日广告票)].
Or [(userName, u'登陆失败', u'登陆失败', '-1', '-1')]
"""
ticketList = []
for userName, userPwd in userNamePwdList:
try:
self.__emitStatus(u'正在使用用户 {0} 登录。。。'.format(userName))
twill_script = """
go http://www.qidian.com/User/Login.aspx
fv 1 txtUserName {0}
fv 1 txtPwd {1}
submit
""".format(userName, userPwd)
twill.execute_string(twill_script)
# Check whether the current url has been go to the line below, if not, means user faile to login, the clause below will throw a exception.
twill.commands.url('http://www.qidian.com/Default.aspx')
self.__emitStatus(u'正在访问用户 {0} 的个人书屋。。。'.format(userName))
twill.commands.go('http://www.qidian.com/User/Index.aspx')
# Get html and begin to parse the html.
html = twill.commands.show()
html = unicode(html, 'gbk')
userType = re.search(ur'用户类型.*?>(.*?)<.*?用户', html).groups()[0]
userScore = re.search(ur'用户积分.*?>(\d+\.?\d*)<.*?分', html).groups()[0]
recNum = re.search(ur'日推荐票.*?现余.*?>(\d+)<.*?次', html).groups()[0]
advNum = re.search(ur'日广告票.*?现余.*?>(\d+)<.*?次', html).groups()[0]
if userType == u'普通':
bigSmall = userScore + u'(大号)' if float(userScore) > 6000 else userScore + u'(小号)'
elif userType == u'初级VIP':
bigSmall = userScore + u'(大号)' if float(userScore) > 1000 else userScore + u'(小号)'
elif userType == u'高级VIP':
bigSmall = userScore + u'(大号)'
ticketList.append((userName, userType, bigSmall, recNum, advNum))
except Exception as e:
print e
self.__emitStatus(u'用户 {0} 登录失败,请检查用户名密码或联系作者更新本软件。。。'.format(userName))
ticketList.append((userName, u'登陆失败', u'登陆失败', '-1', '-1'))
finally:
# Clear the cookies for the next user will login.
twill.commands.clear_cookies()
return ticketList
开发者ID:ghosertEclipse,项目名称:EclipseProject,代码行数:49,代码来源:qidian.py
示例20: test_sso_slo_initiated_by_sp_redirect
def test_sso_slo_initiated_by_sp_redirect():
twill.commands.reset_browser()
twill.execute_string('''
go http://localhost:10002
submit
fv 1 username fred
fv 1 password fred
submit
url http://localhost:10002
submit slo-redirect
url http://localhost:10002
find 'Log on'
go http://localhost:10001
find password
''')
开发者ID:adieu,项目名称:lasso,代码行数:15,代码来源:test_02_slo.py
注:本文中的twill.execute_string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论