本文整理汇总了Python中twill.commands.fv函数的典型用法代码示例。如果您正苦于以下问题:Python fv函数的具体用法?Python fv怎么用?Python fv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upload
def upload(self, input):
self.get("/tool_runner/index?tool_id=upload1")
tc.fv("1", "file_type", "bed")
tc.fv("1", "dbkey", input.get('dbkey', '?'))
tc.formfile("1", "file_data", input['file_path'])
tc.submit("runtool_btn")
tc.code(200)
示例2: login
def login(username, password):
t.add_extra_header("User-Agent", "[email protected]")
t.go(host + "index.php/Special:UserLogin")
t.fv("1", "wpName", username)
t.fv("1", "wpPassword", password)
t.submit("wpLoginAttempt")
示例3: make_intranets
def make_intranets(intranets_name):
""" Make the offices root hierarchy, deleting if it exists"""
global_dict, local_dict = namespaces.get_twill_glocals()
global_dict['intranets_name'] = intranets_name
# Check to see if we have that community, if so, delete it.
commands.go('/' + intranets_name)
br = get_browser()
status = br.get_code()
if status != 404:
# The community shouldn't exist, and so we should get 404
# looking for it. If no 404, then it exists and we should
# delete it.
url = "/%s/delete.html?confirm=1" % intranets_name
commands.go(url)
# Now, make the community and make sure it exists
commands.go("/add_community.html")
commands.fv("save", "title", intranets_name)
desc = "Test intranets root created for Twill test case named '%s'"
commands.fv("save", "description", desc % test_name)
commands.submit()
commands.find("Add Existing")
示例4: login
def login(username):
"""Find user for given username and make the browser logged in"""
global_dict, local_dict = namespaces.get_twill_glocals()
# Set a globabl Twill variable to let Twill scripts now the name
# of the test, e.g. the directory, as well as community name.
#global_dict['test_name'] = test_name
#global_dict['community_name'] = test_name + "-testcase"
global_dict['cwd'] = os.getcwd()
hn = global_dict['localhost_url']
# First logout
logout()
# Do a login
au = global_dict['%s_user' % username]
# Echo to screen
dump("Logging into %s as %s" % (hn, au))
# Continue
ap = global_dict['%s_password' % username]
commands.go(hn + '/login.html')
commands.fv("formLogin", "login", au)
commands.fv("formLogin", "password", ap)
commands.submit()
# Make sure the login succeeded
commands.show()
commands.find("My Profile")
示例5: refresh_form
def refresh_form(self, control_name, value, form_no=0, form_id=None, form_name=None, **kwd):
"""Handles Galaxy's refresh_on_change for forms without ultimately submitting the form"""
# control_name is the name of the form field that requires refresh_on_change, and value is
# the value to which that field is being set.
for i, f in enumerate(self.showforms()):
if i == form_no or (form_id is not None and f.id == form_id) or (form_name is not None and f.name == form_name):
break
formcontrols = self.get_form_controls(f)
try:
control = f.find_control(name=control_name)
except Exception:
log.debug('\n'.join(formcontrols))
# This assumes we always want the first control of the given name, which may not be ideal...
control = f.find_control(name=control_name, nr=0)
# Check for refresh_on_change attribute, submit a change if required
if 'refresh_on_change' in control.attrs.keys():
# Clear Control and set to proper value
control.clear()
tc.fv(f.name, control.name, value)
# Create a new submit control, allows form to refresh, instead of going to next page
control = ClientForm.SubmitControl('SubmitControl', '___refresh_grouping___', {'name': 'refresh_grouping'})
control.add_to_form(f)
control.fixup()
# Submit for refresh
tc.submit('___refresh_grouping___')
示例6: test_project_actions
def test_project_actions(self):
# main page
tc.go( testlib.PROJECT_LIST_URL )
tc.find("Logged in as")
# default project list
tc.find("Fly data 19")
tc.find("Human HELA 16")
tc.find("Mouse project HBB 1")
# create a new project
name = "Rainbow Connection - New Project"
self.create_project(name=name)
# visit this new project
tc.follow(name)
tc.code(200)
tc.find("Project: %s" % name)
# edit and rename project
newname = "Iguana Garden - New Project"
tc.follow("Edit")
tc.find("Edit Project")
tc.fv("1", "name", newname )
tc.fv("1", "info", "Some other *markup* goes here")
tc.submit()
tc.code(200)
tc.notfind(name)
tc.find(newname)
self.delete_project(name=newname)
示例7: test_project_manager_sharing
def test_project_manager_sharing(self):
# test sharing as a manager
# main page
tc.go( testlib.PROJECT_LIST_URL )
tc.find("Logged in as")
# default project list
tc.find("Yeast mutant RAV 17")
tc.follow("Yeast mutant RAV 17")
tc.follow("Sharing")
tc.find("Current members")
tc.find("Add access")
# search for then add Demo User to this project
tc.fv("1", "text", "demo" )
tc.submit()
tc.code(200)
tc.find("Demo User")
tc.follow("add as member")
tc.find("Demo User")
# back to the project view
tc.follow("<< return to project")
tc.find("Yeast mutant RAV 17")
示例8: create
def create(self, cntrller='user', email='[email protected]', password='testuser', username='admin-user', redirect=''):
# HACK: don't use panels because late_javascripts() messes up the twill browser and it
# can't find form fields (and hence user can't be logged in).
params = dict(cntrller=cntrller, use_panels=False)
self.visit_url("/user/create", params)
tc.fv('registration', 'email', email)
tc.fv('registration', 'redirect', redirect)
tc.fv('registration', 'password', password)
tc.fv('registration', 'confirm', password)
tc.fv('registration', 'username', username)
tc.submit('create_user_button')
previously_created = False
username_taken = False
invalid_username = False
try:
self.check_page_for_string("Created new user account")
except Exception:
try:
# May have created the account in a previous test run...
self.check_page_for_string("User with that email already exists")
previously_created = True
except Exception:
try:
self.check_page_for_string('Public name is taken; please choose another')
username_taken = True
except Exception:
try:
# Note that we're only checking if the usr name is >< 4 chars here...
self.check_page_for_string('Public name must be at least 4 characters in length')
invalid_username = True
except Exception:
pass
return previously_created, username_taken, invalid_username
示例9: authenticate
def authenticate(email, pwd):
print "Authenticating Google Account: %s" % email
browser.go(AUTH_URL)
fv("1", "Email", email)
fv("1", "Passwd", pwd)
browser.submit()
code(200)
示例10: authAndRedirect
def authAndRedirect(username, password):
tw.reset_browser()
tw.go(SYS_REDIRECT_URL)
tw.fv('1', "username", username)
tw.fv('1', "password", password)
tw.formaction('1', AUTH_URL)
tw.submit()
return tw.get_browser().get_html()
示例11: login
def login(self):
from twill import commands as b
b.go('/login')
b.fv('login', 'login', 'chris')
b.fv('login', 'password', 'chris')
b.submit()
b.find('You are logged in as chris.')
示例12: dismod_server_login
def dismod_server_login():
""" login to the dismod server given in dismod3/settings.py."""
twc.go(DISMOD_LOGIN_URL)
twc.fv("1", "username", DISMOD_USERNAME)
twc.fv("1", "password", DISMOD_PASSWORD)
twc.submit()
twc.url("accounts/profile")
示例13: upload_file
def upload_file(self, fname, ftype='auto', dbkey='hg17'):
"""Uploads a file"""
fname = self.get_fname(fname)
tc.go("./tool_runner/index?tool_id=upload1")
tc.fv("1","file_type", ftype)
tc.fv("1","dbkey", dbkey)
tc.formfile("1","file_data", fname)
tc.submit("runtool_btn")
self.home()
示例14: submit_form
def submit_form(self, form=1, button="runtool_btn", **kwd):
"""Populates and submits a form from the keyword arguments"""
for key, value in kwd.items():
# needs to be able to handle multiple values per key
if type(value) != type([]):
value = [ value ]
for elem in value:
tc.fv(str(form), str(key), str(elem) )
tc.submit(button)
示例15: __create_session
def __create_session(self):
browser = get_browser()
browser.go('http://www.erstenachhilfe.de/user?destination=node%2F767')
tw.fv('2', 'edit-name', LOGIN)
tw.fv('2', 'edit-pass', PASSWORD)
tw.showforms()
tw.submit('op')
return browser