本文整理汇总了Python中twill.execute_string函数的典型用法代码示例。如果您正苦于以下问题:Python execute_string函数的具体用法?Python execute_string怎么用?Python execute_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了execute_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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'
''')
示例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)
示例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)
示例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''')
示例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
''')
示例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'
''')
示例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''')
示例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''')
示例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')
示例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)
示例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'
''')
示例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'
''')
示例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
''')
示例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)