• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python commands.code函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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") 
开发者ID:JCVI-Cloud,项目名称:galaxy-tools-prok,代码行数:25,代码来源:functional.py


示例2: 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)
开发者ID:ARTbio,项目名称:galaxy,代码行数:7,代码来源:check_galaxy.py


示例3: test_image_processing_library_error

    def test_image_processing_library_error(self):
        """
        If the image processing library errors while preparing a photo, report a
        helpful message to the user and log the error. The photo is not added
        to the user's profile.
        """
        # Get a copy of the error log.
        string_log = StringIO.StringIO()
        logger = logging.getLogger()
        my_log = logging.StreamHandler(string_log)
        logger.addHandler(my_log)
        logger.setLevel(logging.ERROR)

        self.login_with_twill()
        tc.go(make_twill_url('http://openhatch.org/people/paulproteus/'))
        tc.follow('photo')
        # This is a special image from issue166 that passes Django's image
        # validation tests but causes an exception during zlib decompression.
        tc.formfile('edit_photo', 'photo', photo('static/images/corrupted.png'))
        tc.submit()
        tc.code(200)

        self.assert_("Something went wrong while preparing this" in tc.show())
        p = Person.objects.get(user__username='paulproteus')
        self.assertFalse(p.photo.name)

        # an error message was logged during photo processing.
        self.assert_("zlib.error" in string_log.getvalue())
        logger.removeHandler(my_log)
开发者ID:boblannon,项目名称:oh-mainline,代码行数:29,代码来源:tests.py


示例4: 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


示例5: 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


示例6: test_profile

def test_profile():
    """
    Test user profile
    """
    go(SITE + '/accounts/profile/')
    code(404)
    return
开发者ID:fordexa,项目名称:simpletest,代码行数:7,代码来源:tests.py


示例7: 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


示例8: 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)
开发者ID:akvo,项目名称:akvo-flow-data-config,代码行数:7,代码来源:stats.py


示例9: 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)
开发者ID:JCVI-Cloud,项目名称:galaxy-tools-prok,代码行数:33,代码来源:functional.py


示例10: setup

    def setup(
        self,
        login=None,
        password=None,
        service_url="https://bramka.play.pl",
        login_url="https://logowanie.play.pl/p4-idp2/LoginForm.do",
        logout_url="https://logowanie.play.pl/p4-idp2/LogoutUser",
    ):
        self.SERVICE_URL = service_url
        self.LOGIN_URL = login_url
        self.LOGOUT_URL = logout_url
        self.MY_PHONE_NUMBER = login
        self.MY_PASSWORD = password

        web.config("readonly_controls_writeable", True)
        web.agent(self.MY_HTTP_AGENT)

        web.go(self.SERVICE_URL)
        web.submit()
        web.code(200)
        web.formvalue("loginForm", "login", self.MY_PHONE_NUMBER)
        web.formvalue("loginForm", "password", self.MY_PASSWORD)
        web.submit()
        web.code(200)
        self._retry_find("editableSmsComposeForm", 5)
开发者ID:lukmdo,项目名称:smsgates,代码行数:25,代码来源:contrib.py


示例11: 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


示例12: set_history

 def set_history(self):
     """Sets the history (stores the cookies for this run)"""
     if self.history_id:
         tc.go( "./history?id=%s" % self.history_id )
     else:
         tc.go( "./history" )
     tc.code(200)
开发者ID:blankenberg,项目名称:galaxy-central,代码行数:7,代码来源:twilltestcase.py


示例13: 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


示例14: main

def main():

    login, password = get_credentials()

    # log-in to Django site
    if login and password:
        tw.go(LOGIN_URL)
        tw.formvalue('1', 'username', login)
        tw.formvalue('1', 'password', password)
        tw.submit()

    if isinstance(DATA_URL, basestring):
        urls = [DATA_URL]
    else:
        urls = list(DATA_URL)

    # retrieve URIs
    for url in urls:
        try:
            tw.go(url)
            tw.code('200')
            tw.show()
        except TwillAssertionError:
            code = get_browser().get_code()           
            print (u"Unable to access %(url)s. "
                   u"Received HTTP #%(code)s."
                   % {'url': url, 'code': code})
    tw.reset_browser()
开发者ID:yeleman,项目名称:red_nut,代码行数:28,代码来源:refresh_cache.py


示例15: 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


示例16: parse_entry_count

def parse_entry_count(instance, kind):
    url = BASE_URL + instance + "&kind=" + kind
    browser.go(url)
    code(200)
    html = browser.get_html()
    result = count_regex.search(html)
    if result:
        return result.group(1).replace(",", "")#Avoid commas
    return "0"
开发者ID:akvo,项目名称:akvo-flow-data-config,代码行数:9,代码来源:stats.py


示例17: general_login_action

 def general_login_action(self, username, password, message):
     """ login with given login/password and find given message on page """
     go(SITE)
     code(200)
     fv(1, 'username', username)
     fv(1, 'password', password)
     submit()
     code(200)
     find(message)
开发者ID:xaratt,项目名称:andrytest,代码行数:9,代码来源:test.py


示例18: delete_data

 def delete_data(self, hid):
     """Deletes data at a certain history id"""
     hid = str(hid)
     data_list = self.get_data_list()
     self.assertTrue( data_list )
     elems = [ elem for elem in data_list if elem.get('hid') == hid ]
     self.assertEqual(len(elems), 1)
     tc.go("/delete?id=%s" % elems[0].get('id') )
     tc.code(200)
开发者ID:blankenberg,项目名称:galaxy-central,代码行数:9,代码来源:twilltestcase.py


示例19: test_it

 def test_it(self):
     from twill import commands as b
     b.follow('1975-11-04')
     b.find('1975-11-04')
     b.follow('photo_02.jpg')
     b.find('Test 2')
     b.find('November 4, 1975')
     b.follow('download')
     b.code(200)
开发者ID:chrisrossi,项目名称:edwin,代码行数:9,代码来源:test_photo.py


示例20: check_data

    def check_data(self, fname, hid=None, wait=True):
        """
        Verifies that a data at a history id is indentical to
        the contents of a file
        """

        if wait:  # wait for tools to finish
            self.wait()

        data_list = self.get_data_list()
        self.assertTrue( data_list )

        if hid is None: # take last hid
            elem = data_list[-1]
        else:
            hid = str(hid)
            elems = [ elem for elem in data_list if elem.get('hid') == hid ]
            self.assertTrue( len(elems) == 1 )
            elem = elems[0]

        if elem.get('state') != 'ok':
            tc.go("./history")
            tc.code(200)
#          print tc.show()

        hid = elem.get('hid')
        self.assertTrue( hid )
        self._assert_dataset_state( elem, 'ok' )

        local_name = self.get_fname(fname)
        temp_name  = self.get_fname('temp_%s' % fname)
        tc.go("./display?hid=" + str(hid) )

        data = self.last_page()
        file(temp_name, 'wb').write(data)

        if not filecmp.cmp(local_name, temp_name):
            #maybe it is just the line endings
            lc = 0
            for line1, line2 in zip(file(local_name), file(temp_name)):
                lc += 1
                line1 = line1.strip()
                line2 = line2.strip()
                if line1 != line2:
                    # nicer message
                    fromlines = open( local_name, 'U').readlines()
                    tolines = open( temp_name, 'U').readlines()
                    diff = difflib.unified_diff( fromlines, tolines, "local_file", "history_data" )
                    diff_slice = list( islice( diff, 40 ) )
                    if len( diff_slice ) == 40:
                        errmsg = [ 'Data at history id %s does not match expected, first 40 lines of diff:\n' % hid ]
                    else:
                        errmsg = [ 'Data at history id %s does not match expected, diff:\n' % hid ]
                    errmsg += diff_slice
                    raise AssertionError( "".join( errmsg ) )
        os.remove(temp_name)
开发者ID:blankenberg,项目名称:galaxy-central,代码行数:56,代码来源:twilltestcase.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python commands.find函数代码示例发布时间:2022-05-27
下一篇:
Python twill.set_output函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap