当前位置: 首页>>代码示例>>Python>>正文


Python commands.find函数代码示例

本文整理汇总了Python中twill.commands.find函数的典型用法代码示例。如果您正苦于以下问题:Python find函数的具体用法?Python find怎么用?Python find使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了find函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

def main():
    joker = SpawnKillerThread()
    try:
        SpawnDistributedCluster()
        print "Waiting for two JBoss instances to start up in cluster mode..."
        time.sleep(10)
        joker.start()
        #commands.debug('http', 1)
        #commands.debug('commands',1)
        b = get_browser()
        import socket
        myip = "http://" + socket.gethostbyname(socket.gethostname())
        b.go(myip + "/session-basket")
        b.submit(5)
        wordBatch = listOfRandomWords()
        for idx, w in enumerate(wordBatch):
            print "Adding word %d: '%s' to the list..." % (idx, w)
            commands.formvalue("1", "newItem:j_idt11", w)
            b.submit(4)
            commands.code(200)
            commands.find(w)
            time.sleep(0.25)
        print wordBatch, len(wordBatch)
        b.submit(5)
        commands.code(200)
        commands.reload()
        for w in wordBatch:
            commands.find(w)
    finally:
        joker.stopKilling = True
        joker.join()
        KillJBoss(0)
        KillJBoss(1)
开发者ID:mperdikeas,项目名称:tools,代码行数:33,代码来源:test-cluster-deployment-of-session-baskets.py

示例2: test_login_auth

 def test_login_auth(self):
     """ test login page """
     self.general_login_action('user1', 'password1', 'Welcome, user1')
     go("%s/accounts/login/" % SITE)
     code(200)
     url('/accounts/profile/')
     find('Welcome, user1')
开发者ID:xaratt,项目名称:andrytest,代码行数:7,代码来源:test.py

示例3: test_confirm_password_reset

 def test_confirm_password_reset(self):
     """
     create confirmation link as Django engine and
     test it for resetting password
     """
     test_email = '[email protected]'
     go(SITE)
     code(200)
     follow('reset password')
     code(200)
     fv(2, 'email', test_email)
     submit()
     code(200)
     #create links
     from django.contrib.auth.tokens import default_token_generator
     from django.utils.http import int_to_base36
     users = User.objects.filter(email__iexact=test_email)
     for user in users:
         link = "%s/accounts/password/reset_confirm/%s/%s/" % (SITE,
                 int_to_base36(user.id),
                 default_token_generator.make_token(user))
         go(link)
         code(200)
         find('Password reset confirm')
         fv(2, 'new_password1', 'test')
         fv(2, 'new_password2', 'test')
         submit()
         code(200)
         find('Your password was successfully reseted')
         self.general_login_action(user.username,
                                 'test',
                                 "Welcome, %s" % user.username)
开发者ID:xaratt,项目名称:andrytest,代码行数:32,代码来源:test.py

示例4: 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)
开发者ID:Falmarri,项目名称:karl,代码行数:25,代码来源:twillcommands.py

示例5: 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")
开发者ID:Falmarri,项目名称:karl,代码行数:25,代码来源:twillcommands.py

示例6: test_registration_user_exists

 def test_registration_user_exists(self):
     """ failed registration with existing username """
     self.general_reg_action('user1',
                             '[email protected]',
                             'password3',
                             'password3')
     find('This username is already taken. Please choose another.')
开发者ID:xaratt,项目名称:andrytest,代码行数:7,代码来源:test_djangoregistration.py

示例7: 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")
开发者ID:Falmarri,项目名称:karl,代码行数:32,代码来源:twillcommands.py

示例8: test_change_password

def test_change_password():
    """
    Test user password change
    """
    go(SITE + '/accounts/login/')
    code(200)
    show()
    formvalue(1, 'username', 'test')
    formvalue(1, 'password', '1')
    submit()
    code(200)
    go(SITE + '/accounts/password/change/')
    code(200)
    show()
    formvalue(1, 'old_password', '1')
    formvalue(1, 'new_password1', '2')
    formvalue(1, 'new_password2', '2')
    submit()
    code(200)
    find('Password change successful')
    go(SITE + '/accounts/login/')
    code(200)
    show()
    formvalue(1, 'username', 'test')
    formvalue(1, 'password', '2')
    submit()
    code(200)
    return
开发者ID:fordexa,项目名称:simpletest,代码行数:28,代码来源:tests.py

示例9: logout

 def logout(self):
     "Performs a logout"
     tc.go( testlib.PROJECT_LIST_URL )
     tc.code(200)
     tc.go("/logout/")
     tc.code(200)
     tc.find("You are not logged in")
开发者ID:JCVI-Cloud,项目名称:galaxy-tools-prok,代码行数:7,代码来源:functional.py

示例10: send

    def send(self, msg, *send_to):
        """
        @todo: make use of native vodafone multi-recipients functionality
        """
        for contact in send_to:
            web.follow(self.SERVICE_URL)

            try:
                web.find("/myv/messaging/webtext/Challenge.shtml")
            except twill.errors.TwillAssertionError, e:
                pass
            else:
                web.go("/myv/messaging/webtext/Challenge.shtml")
                with tempfile.NamedTemporaryFile(suffix=".jpeg") as captcha:
                    web.save_html(captcha.name)
                    web.back()
                    os.system("open %s " % captcha.name)
                    web.formvalue("WebText", "jcaptcha_response", raw_input("Captcha: "))

            web.formvalue("WebText", "message", msg)
            to = getattr(contact, "mobile", contact)
            web.formvalue("WebText", "recipient_0", to)

            web.sleep(2)
            web.submit()
            web.code(200)
            web.find("Message sent!")
开发者ID:lukmdo,项目名称:smsgates,代码行数:27,代码来源:contrib.py

示例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.')
开发者ID:chrisrossi,项目名称:edwin,代码行数:8,代码来源:twillbase.py

示例12: 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')
开发者ID:boblannon,项目名称:oh-mainline,代码行数:8,代码来源:tests.py

示例13: run_tool

 def run_tool(self, tool_id, **kwd):
     tool_id = tool_id.replace(" ", "+")
     """Runs the tool 'tool_id' and pass it the key/values from the *kwd"""
     tc.go("%s/tool_runner/index?tool_id=%s" % (self.url, tool_id) )
     tc.code(200)
     tc.find('runtool_btn')
     self.submit_form(**kwd)
     tc.code(200)
开发者ID:blankenberg,项目名称:galaxy-central,代码行数:8,代码来源:twilltestcase.py

示例14: 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')
开发者ID:boblannon,项目名称:oh-mainline,代码行数:9,代码来源:tests.py

示例15: 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.')
开发者ID:boblannon,项目名称:oh-mainline,代码行数:9,代码来源:tests.py


注:本文中的twill.commands.find函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。