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


Python commands.code函数代码示例

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


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


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