本文整理汇总了Python中trac.tests.functional.tc.find函数的典型用法代码示例。如果您正苦于以下问题:Python find函数的具体用法?Python find怎么用?Python find使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runTest
def runTest(self):
"""Set preferences for syntax highlighting."""
self._tester.go_to_preferences("Syntax Highlighting")
tc.find('<option value="trac" selected="selected">')
tc.formvalue('userprefs', 'style', 'Emacs')
tc.submit()
tc.find('<option value="emacs" selected="selected">')
示例2: runTest
def runTest(self):
"""Test for regression of http://trac.edgewall.org/ticket/11515
Show a notice message with new language setting after it is changed.
"""
from trac.util.translation import has_babel, get_available_locales
from pkg_resources import resource_exists, resource_filename
if not has_babel:
return
if not resource_exists("trac", "locale"):
return
locale_dir = resource_filename("trac", "locale")
from babel.support import Translations
string = "Your preferences have been saved."
translated = None
for second_locale in get_available_locales():
tx = Translations.load(locale_dir, second_locale)
translated = tx.dgettext("messages", string)
if string != translated:
break # the locale has a translation
else:
return
try:
self._tester.go_to_preferences("Language")
tc.formvalue("userprefs", "language", second_locale)
tc.submit()
tc.find(re.escape(translated))
finally:
tc.formvalue("userprefs", "language", "") # revert to default
tc.submit()
tc.find("Your preferences have been saved")
示例3: runTest
def runTest(self):
"""Test for regression of http://trac.edgewall.org/ticket/11069
The permissions list should only be populated with permissions that
the user can grant."""
self._tester.go_to_front()
self._tester.logout()
self._tester.login('user')
self._testenv.grant_perm('user', 'PERMISSION_GRANT')
env = self._testenv.get_trac_environment()
from trac.perm import PermissionSystem
user_perms = PermissionSystem(env).get_user_permissions('user')
all_actions = PermissionSystem(env).get_actions()
try:
self._tester.go_to_admin("Permissions")
for action in all_actions:
option = r"<option>%s</option>" % action
if action in user_perms and user_perms[action] is True:
tc.find(option)
else:
tc.notfind(option)
finally:
self._testenv.revoke_perm('user', 'PERMISSION_GRANT')
self._tester.go_to_front()
self._tester.logout()
self._tester.login('admin')
示例4: runTest
def runTest(self):
"""Edit a wiki page."""
pagename = self._tester.create_wiki_page()
self._tester.edit_wiki_page(pagename)
tc.find("Your changes have been saved in version 2")
tc.find(r'\(<a href="/wiki/%s\?action=diff&version=2">diff</a>\)'
% pagename)
示例5: runTest
def runTest(self):
"""Test for regression of http://trac.edgewall.org/ticket/11194
TracError should be raised when repository with name already exists
"""
self._tester.go_to_admin()
tc.follow("\\bRepositories\\b")
tc.url(self._tester.url + "/admin/versioncontrol/repository")
word = random_word()
names = ["%s_%d" % (word, n) for n in xrange(3)]
tc.formvalue("trac-addrepos", "name", names[0])
tc.formvalue("trac-addrepos", "dir", "/var/svn/%s" % names[0])
tc.submit()
tc.notfind(internal_error)
tc.formvalue("trac-addrepos", "name", names[1])
tc.formvalue("trac-addrepos", "dir", "/var/svn/%s" % names[1])
tc.submit()
tc.notfind(internal_error)
tc.follow("\\b" + names[1] + "\\b")
tc.url(self._tester.url + "/admin/versioncontrol/repository/" + names[1])
tc.formvalue("edit", "name", names[2])
tc.submit("save")
tc.notfind(internal_error)
tc.url(self._tester.url + "/admin/versioncontrol/repository")
tc.follow("\\b" + names[2] + "\\b")
tc.url(self._tester.url + "/admin/versioncontrol/repository/" + names[2])
tc.formvalue("edit", "name", names[0])
tc.submit("save")
tc.find('The repository "%s" already exists.' % names[0])
tc.notfind(internal_error)
示例6: runTest
def runTest(self):
"""Admin modify priority details"""
name = "DetailPriority"
# Create a priority
self._tester.create_priority(name + '1')
# Modify the details of the priority
priority_url = self._tester.url + "/admin/ticket/priority"
tc.go(priority_url)
tc.url(priority_url + '$')
tc.follow(name + '1')
tc.url(priority_url + '/' + name + '1')
tc.formvalue('edit', 'name', name + '2')
tc.submit('save')
tc.url(priority_url + '$')
# Cancel more modifications
tc.go(priority_url)
tc.follow(name)
tc.formvalue('edit', 'name', name + '3')
tc.submit('cancel')
tc.url(priority_url + '$')
# Verify that only the correct modifications show up
tc.notfind(name + '1')
tc.find(name + '2')
tc.notfind(name + '3')
示例7: test_set_owner_one_choice
def test_set_owner_one_choice(self):
"""When using the workflow operation `set_owner` with
a specific single-element list of available owners, the assign-to field
will not give the end user any choices at all.
"""
try:
ticket_id = self._tester.create_ticket(self.__class__.__name__,
info={'owner': 'lammy'})
self.env.config.set('ticket-workflow', 'reassign.set_owner',
"alice")
self.env.config.save()
self._tester.go_to_ticket(ticket_id)
tc.notfind('<select name="action_reassign_reassign_owner"')
tc.find('<input type="hidden" '
'name="action_reassign_reassign_owner" '
'value="alice" id="action_reassign_reassign_owner" />')
tc.find('The owner will be changed from '
'<span class="trac-author">lammy</span> to '
'<span class="trac-author">alice</span>')
tc.notfind('<input type="text" name="action_reassign_reassign_owner" '
'value="admin" id="action_reassign_reassign_owner" />')
tc.notfind('<option selected="selected" value="admin">admin</option>')
tc.notfind('<option value="admin">admin</option>')
tc.notfind('<input type="text" name="action_reassign_reassign_owner" '
'value="lammy" id="action_reassign_reassign_owner" />')
tc.notfind('<option selected="selected" value="lammy">lammy</option>')
tc.notfind('<option value="lammy">lammy</option>')
finally:
self.env.config.remove('ticket-workflow', 'reassign.set_owner')
示例8: runTest
def runTest(self):
self.tester.login_as(Usernames.product_owner)
requirement_id = self.tester.create_new_agilo_requirement('My Requirement')
self.tester.go_to_view_ticket_page(requirement_id)
self.tester.select_form_for_twill('attachfile', 'attachfilebutton')
tc.submit('attachfile')
tc.find('Add Attachment to')
示例9: test_set_owner
def test_set_owner(self):
"""When using the workflow operation `set_owner` with
a specific list of available owners, the assign-to field
will only contain that list of owners. The requesting user
will not be added to the list, and the current ticket owner
will not be added to the list.
"""
try:
ticket_id = self._tester.create_ticket(self.__class__.__name__,
info={'owner': 'lammy'})
self.env.config.set('ticket-workflow', 'reassign.set_owner',
"alice,bill")
self.env.config.save()
self._tester.go_to_ticket(ticket_id)
tc.find('The owner will be changed from '
'<span class="trac-author">lammy</span>')
tc.notfind('<input type="text" name="action_reassign_reassign_owner" '
'value="admin" id="action_reassign_reassign_owner" />')
tc.notfind('<option selected="selected" value="admin">admin</option>')
tc.notfind('<option value="admin">admin</option>')
tc.notfind('<input type="text" name="action_reassign_reassign_owner" '
'value="lammy" id="action_reassign_reassign_owner" />')
tc.notfind('<option selected="selected" value="lammy">lammy</option>')
tc.notfind('<option value="lammy">lammy</option>')
finally:
self.env.config.remove('ticket-workflow', 'reassign.set_owner')
示例10: runTest
def runTest(self):
"""Test for regression of http://trac.edgewall.org/ticket/11302"""
pagename = self._tester.create_wiki_page()
self._tester.attach_file_to_wiki(
pagename, description="illustrates [./@1#point1]")
self._tester.go_to_wiki(pagename + '?action=edit')
tc.find(r'illustrates <a class="wiki"'
r' href="/wiki/%s\?version=1#point1">@1</a>' % pagename)
示例11: runTest
def runTest(self):
self._tester.login_as(Usernames.product_owner)
ticket_info = self._tester.perform_import(GOOD_CSV_DATA)
csv_delete_data = self._tester.build_csv_for_ticket_deletion_from(ticket_info)
encoding = self._tester.upload_csv_for_update_import(csv_delete_data)
tc.find('<h1>Update Preview</h1>')
tc.find('File contents read with encoding <b>%s</b>.' % encoding)
示例12: runTest
def runTest(self):
"""Turn off logging."""
# For now, we just check that it shows up.
self._tester.go_to_admin("Logging")
tc.find('trac.log')
tc.formvalue('modlog', 'log_type', 'none')
tc.submit()
tc.find('selected="selected">None</option')
示例13: runTest
def runTest(self):
self._tester.login_as(Usernames.product_owner)
ticket_id = self._tester.create_new_agilo_ticket(Type.REQUIREMENT, 'req')
self._tester.go_to_view_ticket_page(ticket_id)
new_summary = 'really interesting'
tc.formvalue('propertyform', 'field_summary', new_summary)
tc.submit('submit')
tc.find(new_summary)
示例14: _test_ajax_update_fields
def _test_ajax_update_fields(self):
# test Ajax functionality by clicking "update fields" or
# passing the new values as a GET parameter
tc.fv('modcomp', 'scope', 'milestone')
tc.submit('preview')
# see if the available and selected fields for this backlog
# type are display correctly
tc.find('<option selected="selected" [^>]*>milestone</option>')
示例15: runTest
def runTest(self):
self._tester.login_as(Usernames.team_member)
page_url = self._tester.url + TEAM_URL
tc.go(page_url)
tc.url(page_url)
tc.code(200)
tc.follow('Team#1')
tc.code(200)
tc.find('Member#1')