本文整理汇总了Python中twill.commands.notfind函数的典型用法代码示例。如果您正苦于以下问题:Python notfind函数的具体用法?Python notfind怎么用?Python notfind使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了notfind函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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)
示例2: catalog_find
def catalog_find(searchterm, urlfrag, notfind=False):
"""Just like Twill find, but issues a searchpage-search search"""
global_dict, local_dict = namespaces.get_twill_glocals()
# This will navigate us away from the place the Twill script is
# sitting. Thus, stash away to the current URL, then navigate
# back to that URL after searching.
br = get_browser()
start_url = br.get_url()
esc_searchterm = urllib.quote(searchterm)
url = "/searchresults.html?body=" + esc_searchterm
commands.go(url)
# Now do the test. With the fragment of the URL that was
# provided, we can do a double-check, to make sure the
# searchresults provide that.
if notfind:
commands.notfind(urlfrag)
else:
commands.find(urlfrag)
# Finally, send them back to the original URL.
commands.go(start_url)
示例3: test_logout_web
def test_logout_web(self):
self.test_login_web()
url = 'http://openhatch.org/search/'
url = make_twill_url(url)
tc.go(url)
tc.notfind('log in')
tc.follow('log out')
tc.find('log in')
示例4: test_usernames_case_insensitive
def test_usernames_case_insensitive(self):
tc.go(make_twill_url("http://openhatch.org/account/signup/"))
tc.notfind("already got a user in our database with that username")
tc.fv("signup", "username", "PaulProteus")
tc.fv("signup", "email", "[email protected]")
tc.fv("signup", "password1", "blahblahblah")
tc.fv("signup", "password2", "blahblahblah")
tc.submit()
tc.find("already got a user in our database with that username")
示例5: test_reserved_username
def test_reserved_username(self):
tc.go(make_twill_url('http://openhatch.org/account/signup/'))
tc.notfind('That username is reserved.')
tc.fv('signup', 'username', 'admin')
tc.fv('signup', 'email', '[email protected]')
tc.fv('signup', 'password1', 'blahblahblah')
tc.fv('signup', 'password2', 'blahblahblah')
tc.submit()
tc.find('That username is reserved.')
示例6: delete_project
def delete_project(self, name):
"""
Deletes a project
"""
tc.follow("Delete")
tc.find("You are removing")
tc.fv("1", "delete", True)
tc.submit()
tc.code(200)
tc.find("Project deletion complete")
tc.notfind(name)
示例7: push_item
def push_item(projectname, summary, comment, status, label):
go("http://code.google.com/p/%s/issues/list" % (projectname,))
follow("New Issue")
fv("3", "summary", summary)
fv("3", "comment", wraptext(comment))
fv("3", "status", status)
fv("3", "labelenter0", label)
fv("3", "labelenter1", "")
submit("submit")
notfind("Letters did not match")
示例8: push_item
def push_item(projectname, summary, comment, status, label):
go('http://code.google.com/p/%s/issues/list' % (projectname, ))
follow('New Issue')
fv('3', 'summary', summary)
fv('3', 'comment', wraptext(comment))
fv('3', 'status', status)
fv("3", "labelenter0", label)
fv("3", "labelenter1", "")
submit('submit')
notfind("Letters did not match")
示例9: test_project_member_sharing
def test_project_member_sharing(self):
# tests sharing as a member
tc.go( testlib.PROJECT_LIST_URL )
tc.find("Logged in as")
# a project list with member access
tc.find("Fly data 19")
tc.follow("Fly data 19")
tc.follow("Sharing")
tc.find("Current members")
# members may not add access
tc.notfind("Add access")
tc.follow("<< return to project")
tc.find("Project: Fly data 19")
示例10: send
def send(self, msg, *send_to):
web.go(self.SERVICE_URL)
self._retry_find("editableSmsComposeForm", 5)
try:
page = web.get_browser().get_html()
web.notfind("inputCaptcha")
except twill.errors.TwillAssertionError, e:
found = re.search("(/composer/public/jcaptcha\?id=.*)", page)
assert found
web.go(found.groups()[0])
with tempfile.NamedTemporaryFile(suffix=".jpeg") as captcha:
web.save_html(captcha.name)
web.back()
os.system("open %s " % captcha.name)
web.formvalue("editableSmsComposeForm", "inputCaptcha", raw_input("Captcha: "))
示例11: make_files
def make_files(pagename):
redfilename = "/tmp/Red-%s" % pagename
greenfilename = "/tmp/Green-%s" % pagename
bluefilename = "/tmp/Blue-%s" % pagename
# create a small test image.
gd.gdMaxColors = 256
i = gd.image((200, 100))
black = i.colorAllocate((0, 0, 0))
white = i.colorAllocate((255, 255, 255))
red = i.colorAllocate((255, 55, 55))
green = i.colorAllocate((55, 255, 55))
blue = i.colorAllocate((55, 55, 255))
# now write a red version
i.rectangle((0, 0), (199, 99), red, red)
i.line((0, 0), (199, 99), black)
i.string(gd.gdFontLarge, (5, 50), pagename, white)
i.writePng(redfilename)
# now write a green version
i.rectangle((0, 0), (199, 99), green, green)
i.line((0, 0), (99, 99), black)
i.string(gd.gdFontLarge, (5, 50), pagename, white)
i.writePng(greenfilename)
# write a blue version
i.rectangle((0, 0), (199, 99), blue, blue)
i.line((0, 0), (99, 199), black)
i.string(gd.gdFontLarge, (5, 50), pagename, white)
i.writePng(bluefilename)
# propose that we delete it (in case it exists)
t.go(host + "index.php?title=File:%s&action=delete" % pagename)
# make sure that we've NOT gotten the wrong page and HAVE gotten the right one.
t.notfind("You are about to delete the file")
t.find("could not be deleted")
return (redfilename, greenfilename, bluefilename)
示例12: test_edit_email_address
def test_edit_email_address(self):
# Opt out of the periodic emails. This way, the only "checked"
# checkbox is the one for if the user's email address gets shown.
paulproteus = Person.objects.get()
paulproteus.email_me_re_projects = False
paulproteus.save()
self.login_with_twill()
_url = 'http://openhatch.org/account/settings/contact-info/'
url = make_twill_url(_url)
email = '[email protected]'
# Go to contact info form
tc.go(url)
# Let's first ensure that "[email protected]" doesn't appear on the page.
# (We're about to add it.)
tc.notfind('checked="checked"')
tc.notfind(email)
# Edit email
tc.fv("a_settings_tab_form", 'edit_email-email', email)
# Show email
tc.fv("a_settings_tab_form", 'show_email-show_email', '1') # [1]
tc.submit()
# Form submission ought to redirect us back to the form.
tc.url(url)
# Was email successfully edited?
tc.find(email)
# Was email visibility successfully edited? [2]
tc.find('checked="checked"')
# And does the email address show up on the profile?
tc.go(make_twill_url(
'http://openhatch.org/people/paulproteus'))
tc.find(email)
# 2. And when we uncheck, does it go away?
# 2.1. Go to contact info form
tc.go(url)
# 2.2. Don't show email
tc.fv("a_settings_tab_form", 'show_email-show_email', '0') # [1]
tc.submit()
# 2.3. Verify it's not on profile anymore
tc.go(make_twill_url(
'http://openhatch.org/people/paulproteus'))
tc.notfind(email)
示例13: runTest
def runTest(self):
"""
The twill test case is useful for emulating a user using HTML forms and clicking on buttons.
Note we cannot connect to the twill server using urllib2 or any other third party client.
Also, we cannot verify the header content in a twill response.
"""
FILTER_FORM = 2
logger = logging.getLogger("TwillTestCase")
url = URL_BASE
twill_quiet()
logger.info('accessing ' + url)
tc.go(url)
tc.find("html") # sanity check that this is a html request.
url = URL_BASE + 'filter/'
logger.info('accessing ' + url)
tc.go(url)
tc.formvalue(FILTER_FORM,'tag','esnet')
tc.submit(9) #simulates a click on the "create filter" button
tc.find("html")
tc.find('<table class="sortable">') #a line in event.list.html
tc.notfind('experiment') #should be filtered out
tc.go(url)
tc.formvalue(FILTER_FORM,'display','timeline')
tc.submit(9) #click should direct us to timeline.
tc.find("html")
tc.notfind('<table class="sortable">')
tc.go(url)
tc.formvalue(FILTER_FORM,'display','json')
tc.submit(9) #click should give us JSON object.
tc.find('"pk": 1') #part of JSON string.
tc.notfind("html")
tc.go(url)
tc.formvalue(FILTER_FORM,'name','upgrade')
tc.formvalue(FILTER_FORM,'search','www.es.net')
tc.formvalue(FILTER_FORM,'description','infrastructure')
tc.submit(9)
tc.find('html')
tc.find('www.es.net') #part of the upgrade event.
#Set headers to contain only the json mime
tc.clear_extra_headers()
tc.add_extra_header('Accept',JSON_MIME)
url = URL_BASE
logger.info('accessing ' + url)
tc.go(url)
logger.debug('JSON data:' + tc.show())
tc.notfind("html")
tc.find('"name": "experiment"') #data from the fixture formatted by default serializer
tc.find('"tags": "esnet"')
url = URL_BASE + '1/'
logger.info('accessing ' + url)
tc.go(url)
tc.notfind("html")
tc.find('"name": "experiment"')
tc.notfind('"tags": "esnet"')
示例14: test_simple_list_no_dotfiles
def test_simple_list_no_dotfiles(root):
root.join(".foo-1.0.zip").write("secret")
go("/simple/")
notfind("foo")
示例15: test_it
def test_it(self):
from twill import commands as b
b.follow('October 1975')
b.find('1975-10-19')
b.notfind('1975-12-06')