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

Python commands.go函数代码示例

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

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



在下文中一共展示了go函数的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: 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


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


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


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


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

    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


示例8: minitwill

def minitwill(url, script):
    '''Dada una URL y un script en una versión limitada
    de twill, ejecuta ese script.
    Apenas una línea falla, devuelve False.

    Si todas tienen éxito, devuelve True.

    Ejemplos:

    >>> minitwill('http://google.com','code 200')
    ==> at http://www.google.com.ar/
    True

    >>> minitwill('http://google.com','title bing')
    ==> at http://www.google.com.ar/
    title is 'Google'.
    False

    '''
    try:
        go(url)
    except:
        return False
    for line in script.splitlines():
        cmd, arg = line.split(' ', 1)
        try:
            if cmd in ['code', 'find', 'notfind', 'title']:
                # Si line es "code 200", esto es el equivalente
                # de code(200)
                r = globals()[cmd](arg)
        except:
            return False
    return True
开发者ID:davidlarizap,项目名称:python-no-muerde,代码行数:33,代码来源:pyurl3.py


示例9: test_BeautifulSoup

def test_BeautifulSoup():
    """
    test parsing of BS-processed HTML.
    """
    b = commands.get_browser()

    commands.config('use_tidy', '0')
    commands.config('use_BeautifulSoup', '1')
    commands.config('allow_parse_errors', '0')

    commands.go(url)

    ###
    # Apparently, mechanize is more tolerant than it used to be.

    # commands.go('/tidy_fixable_html')

    # forms = [ i for i in b._browser.forms() ]
    # assert len(forms) == 0, \
    #        "there should be no correct forms on this page"

    ###

    commands.go('/BS_fixable_html')
    forms = [ i for i in b._browser.forms() ]
    assert len(forms) == 1, \
           "there should be one mangled form on this page"
开发者ID:JonathanRRogers,项目名称:twill,代码行数:27,代码来源:test-broken-html.py


示例10: login

def login():
    if s218:
        page = 'http://129.21.142.218:8008/securesync/login/'
        username = 'JSteacher'
        password = 'poipoi99'
        facility = '0939bcf9d5fe59ff8fde46b5a729a232'
    else:
        page = 'http://129.21.142.118:8008/securesync/login/'
        username = 'knowledgecraft'
        password = 'knowledgecraft'
        facility = 'dbae7005f9b45ce082b5fe0a0985946a'

    print 'Logging In...' 
    go(page)
    print "Forms:"
    showforms()
     
    try:
        # Force try using the first form found on a page.
        formclear('2')
        fv("2", "username", username)
        fv("2", "password", password)
        fv("2", "facility", facility)
        #fv("1", "csrfmiddlewaretoken", '3F1bMuIIM9ERzcp6ceEyFxlT51yJKsK6')
        submit('0')
        content = showSilently()
        print 'debug twill post content:', content
     
    except urllib2.HTTPError, e:
        sys.exit("%d: %s" % (e.code, e.msg))
开发者ID:Sintheros,项目名称:learninglandscape-codebase,代码行数:30,代码来源:loginToKALITE.py


示例11: login

def login(username, password):
    t.add_extra_header("User-Agent", "[email protected].com")

    t.go(host + "index.php/Special:UserLogin")
    t.fv("1", "wpName", username)
    t.fv("1", "wpPassword", password)
    t.submit("wpLoginAttempt")
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:7,代码来源:smtest.py


示例12: get_xml_history

 def get_xml_history(self):
     """Returns a parsed xml object corresponding to the history"""
     self.home()
     tc.go('./history?template=history.xml' )
     xml = self.last_page()
     tree = ElementTree.fromstring(xml)
     return tree
开发者ID:blankenberg,项目名称:galaxy-central,代码行数:7,代码来源:twilltestcase.py


示例13: minitwill

def minitwill(url, script):
    """Dada una URL y un script en una versión limitada
    de twill, ejecuta ese script.
    Apenas una línea falla, devuelve False.

    Si todas tienen éxito, devuelve True.

    Ejemplos:

    >>> minitwill('http://google.com','code 200')
    ==> at http://www.google.com.ar/
    True
    
    >>> minitwill('http://google.com','title bing')
    ==> at http://www.google.com.ar/
    title is 'Google'.
    False
    
    """
    go(url)
    for line in script.splitlines():
        cmd, arg = line.split(" ", 1)
        try:
            if cmd in ["code", "find", "notfind", "title"]:
                r = globals()[cmd](arg)
        except:
            return False
    return True
开发者ID:fjouret,项目名称:rst2pdf-py3-dev,代码行数:28,代码来源:pyurl3.py


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


示例15: visit_loginurl

def visit_loginurl (aggregate):
    """Check for a login URL and visit it."""
    config = aggregate.config
    url = config["loginurl"]
    if not url:
        return
    if not fileutil.has_module("twill"):
        msg = strformat.format_feature_warning(module=u'twill',
            feature=u'login URL visit',
            url=u'http://twill.idyll.org/')
        log.warn(LOG_CHECK, msg)
        return
    from twill import commands as tc
    log.debug(LOG_CHECK, u"Visiting login URL %s", url)
    configure_twill(tc)
    tc.go(url)
    if tc.get_browser().get_code() != 200:
        log.warn(LOG_CHECK, _("Error visiting login URL %(url)s.") % \
          {"url": url})
        return
    submit_login_form(config, url, tc)
    if tc.get_browser().get_code() != 200:
        log.warn(LOG_CHECK, _("Error posting form at login URL %(url)s.") % \
          {"url": url})
        return
    #XXX store_cookies(tc.get_browser().cj, aggregate.cookies, url)
    resulturl = tc.get_browser().get_url()
    log.debug(LOG_CHECK, u"URL after POST is %s" % resulturl)
    # add result URL to check list
    from ..checker import get_url_from
    aggregate.urlqueue.put(get_url_from(resulturl, 0, aggregate))
开发者ID:bootstraponline,项目名称:linkchecker,代码行数:31,代码来源:__init__.py


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


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


示例18: init

    def init(self, **kw):
        if kw.has_key('stdin'):
            cmd.Cmd.__init__(self, None, stdin=kw['stdin'])
            self.use_rawinput = False
        else:
            cmd.Cmd.__init__(self)

        # initialize a new local namespace.
        namespaces.new_local_dict()

        # import readline history, if available.
        if readline:
            try:
                readline.read_history_file('.twill-history')
            except IOError:
                pass

        # fail on unknown commands? for test-shell, primarily.
        self.fail_on_unknown = kw.get('fail_on_unknown', False)

        # handle initial URL argument
        if kw.get('initial_url'):
            commands.go(kw['initial_url'])
            
        self._set_prompt()

        self.names = []
        
        global_dict, local_dict = namespaces.get_twill_glocals()

        ### add all of the commands from twill.
        for command in parse.command_list:
            fn = global_dict.get(command)
            self.add_command(command, fn.__doc__)
开发者ID:brandizzi,项目名称:retwill,代码行数:34,代码来源:shell.py


示例19: __init__

	def __init__ (self, email, password):
		Browser.go(PANDORA_LOGIN_URL)
		Browser.formvalue(1, 'login_username', email)
		Browser.formvalue(1, 'login_password', password)
		Browser.submit()

		self.webname = Browser.info().split('/').pop()
开发者ID:jfktrey,项目名称:Pandora-Unchained,代码行数:7,代码来源:PandoraUnchained.py


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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python commands.notfind函数代码示例发布时间:2022-05-27
下一篇:
Python commands.get_browser函数代码示例发布时间: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