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


Python commands.show函数代码示例

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


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

示例1: add_class

 def add_class(self, unique_number):
     class_url = self.url + '/' + unique_number
     tc.go(class_url)
     html = StringIO.StringIO()
     twill.set_output(html)
     tc.show()
     soup = BeautifulSoup(html.getvalue())
     table = soup.find('table')
     for row in table.findAll('tr')[1:]:
         columns = row.findAll('td')
         unique = columns[0].string
         days = [d.text for d in columns[1].findAll('span')]
         hour = [d.text for d in columns[2].findAll('span')]
         room = [d.text for d in columns[3].findAll('span')]
         instructor = columns[4].span.text
         new_course = Course(unique, days, hour, room, instructor)
         if self._check_planner_to_add(new_course):
             self.course_set.add(new_course)
             days_to_add = new_course.parse_days()
             hours_to_add = new_course.parse_hours()
             for d in range(len(days_to_add)):
                 for h in range(hours_to_add[d][0], hours_to_add[d][1]):
                     for day in days_to_add[d]:
                         self.grid[h][day] = new_course
             print("Course successfully added.")
开发者ID:jmpo1618,项目名称:UTSchedulePlanner,代码行数:25,代码来源:Planner.py

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

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

示例4: test_simple_index_case

def test_simple_index_case(root):
    root.join("FooBar-1.0.zip").write("")
    root.join("FooBar-1.1.zip").write("")

    go("/simple/foobar")
    show()
    links = list(showlinks())
    assert len(links) == 2
开发者ID:SAEPython,项目名称:pypiserver4sae,代码行数:8,代码来源:test_app.py

示例5: test_nonroot_simple_packages

def test_nonroot_simple_packages(root):
    root.join("foobar-1.0.zip").write("123")
    for url in ["http://nonroot/priv/packages",
                "http://nonroot/priv/packages/"]:
        go(url)
        show()
        links = list(showlinks())
        assert len(links) == 1
        assert links[0].url == "/priv/packages/foobar-1.0.zip"
开发者ID:SAEPython,项目名称:pypiserver4sae,代码行数:9,代码来源:test_app.py

示例6: test_simple_index_list

def test_simple_index_list(root):
    root.join("foobar-1.0.zip").write("")
    root.join("foobar-1.1.zip").write("")
    root.join("foobarbaz-1.1.zip").write("")
    root.join("foobar.baz-1.1.zip").write("")

    go("/simple/")
    show()
    links = list(showlinks())
    assert len(links) == 3
开发者ID:SAEPython,项目名称:pypiserver4sae,代码行数:10,代码来源:test_app.py

示例7: test_root_count

def test_root_count(root):
    go("/")
    show()
    code(200)
    find("PyPI compatible package index serving 0 packages")
    showlinks()

    root.join("Twisted-11.0.0.tar.bz2").write("")
    reload()
    show()
    find("PyPI compatible package index serving 1 packages")
开发者ID:SAEPython,项目名称:pypiserver4sae,代码行数:11,代码来源:test_app.py

示例8: test_profile_record

def test_profile_record():
    """
    Test availability of user profile
    """
    go(SITE + '/accounts/login/')
    code(200)
    show()
    formvalue(1, 'username', 'root')
    formvalue(1, 'password', '1')
    submit()
    code(200)
开发者ID:fordexa,项目名称:simpletest,代码行数:11,代码来源:tests.py

示例9: test_reset_password

def test_reset_password():
    """
    Test user password reset
    """
    go(SITE + '/accounts/password/reset/')
    code(200)
    show()
    formvalue(1, 'email', '[email protected]')
    submit()
    code(200)
    find('Password reset successful')
    return
开发者ID:fordexa,项目名称:simpletest,代码行数:12,代码来源:tests.py

示例10: test_incorrect_username

def test_incorrect_username():
    """
    Test an incorrect log in to site with invalid username
    """
    go(SITE + '/accounts/login/')
    code(200)
    show()
    formvalue(1, 'username', 'testincorrect')
    formvalue(1, 'password', '1')
    submit()
    code(200)
    find('Please enter a correct username and password.')
    return
开发者ID:fordexa,项目名称:simpletest,代码行数:13,代码来源:tests.py

示例11: test_success_login

def test_success_login():
    """
    Test a success log in to site
    """
    go(SITE + '/accounts/login/')
    code(200)
    show()
    formvalue(1, 'username', 'test')
    formvalue(1, 'password', '1')
    submit()
    code(200)
    find('<h4 align="center">My profile</h4>')
    return
开发者ID:fordexa,项目名称:simpletest,代码行数:13,代码来源:tests.py

示例12: _requestLikes

	def _requestLikes (self, startingLike, startingThumb):
		url = PANDORA_LIKES_URL.substitute(webname = self.webname, likestart = startingLike, thumbstart = startingThumb)
		Browser.go(url)

		likesList = self._songHtmlToList(Browser.show())

		soup = BeautifulSoup(Browser.show())
		nextInfoElement = soup.find('div', {'class': 'show_more tracklike'})

		nextStartingLike = self._attributeNumberValueOrZero(nextInfoElement, 'data-nextlikestartindex')
		nextStartingThumb = self._attributeNumberValueOrZero(nextInfoElement, 'data-nextthumbstartindex')

		return (likesList, nextStartingLike, nextStartingThumb)
开发者ID:jfktrey,项目名称:Pandora-Unchained,代码行数:13,代码来源:PandoraUnchained.py

示例13: test_register

def test_register():
    """
    Test user registration
    """
    go(SITE + '/accounts/register/')
    code(200)
    show()
    formvalue(1, 'username', 'demouser')
    formvalue(1, 'email', '[email protected]')
    formvalue(1, 'password1', '1')
    formvalue(1, 'password2', '1')
    submit()
    code(200)
    find('Confirmation e-mail sent')
    return
开发者ID:fordexa,项目名称:simpletest,代码行数:15,代码来源:tests.py

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

示例15: get_job_queue

def get_job_queue():
    """
    fetch list of disease model jobs waiting to run from dismod server
    given in settings.py.
    """
    dismod_server_login()
    twc.go(DISMOD_LIST_JOBS_URL)
    return json.loads(twc.show())
开发者ID:flaxter,项目名称:gbd,代码行数:8,代码来源:disease_json.py


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