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


Python tests.make_twill_url函数代码示例

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


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

示例1: test_edit_email_address

    def test_edit_email_address(self):
        # Opt out of the periodic emails. This way, the only "checked"
        # checkbox is the one for if the user's email address gets shown.
        paulproteus = Person.objects.get()
        paulproteus.email_me_re_projects = False
        paulproteus.save()

        self.login_with_twill()
        

        _url = 'http://openhatch.org/account/settings/contact-info/'
        url = make_twill_url(_url)

        email = '[email protected]'

        # Go to contact info form
        tc.go(url)

        # Let's first ensure that "[email protected]" doesn't appear on the page.
        # (We're about to add it.)
        tc.notfind('checked="checked"')
        tc.notfind(email)

        # Edit email
        tc.fv("a_settings_tab_form", 'edit_email-email', email)
        # Show email
        tc.fv("a_settings_tab_form", 'show_email-show_email', '1') # [1]
        tc.submit()

        # Form submission ought to redirect us back to the form.
        tc.url(url)

        # Was email successfully edited? 
        tc.find(email)

        # Was email visibility successfully edited? [2]
        tc.find('checked="checked"')

        # And does the email address show up on the profile?
        tc.go(make_twill_url(
                'http://openhatch.org/people/paulproteus'))
        tc.find(email)

        # 2. And when we uncheck, does it go away?
        
        # 2.1. Go to contact info form
        tc.go(url)

        # 2.2. Don't show email
        tc.fv("a_settings_tab_form", 'show_email-show_email', '0') # [1]
        tc.submit()

        # 2.3. Verify it's not on profile anymore
        tc.go(make_twill_url(
                'http://openhatch.org/people/paulproteus'))
        tc.notfind(email)
开发者ID:boblannon,项目名称:oh-mainline,代码行数:56,代码来源:tests.py

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

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

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

示例5: 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:reik,项目名称:oh-mainline,代码行数:9,代码来源:tests.py

示例6: test_set_avatar

 def test_set_avatar(self):
     self.login_with_twill()
     for image in (photo('static/sample-photo.png'),
                   photo('static/sample-photo.jpg')):
         url = 'http://openhatch.org/people/paulproteus/'
         tc.go(make_twill_url(url))
         tc.follow('photo')
         tc.formfile('edit_photo', 'photo', image)
         tc.submit()
         # Now check that the photo == what we uploaded
         p = Person.objects.get(user__username='paulproteus')
         self.assert_(p.photo.read() ==
                 open(image).read())
开发者ID:boblannon,项目名称:oh-mainline,代码行数:13,代码来源:tests.py

示例7: test_set_avatar_too_wide

 def test_set_avatar_too_wide(self):
     self.login_with_twill()
     for image in [photo('static/images/too-wide.jpg'),
                   photo('static/images/too-wide.png')]:
         url = 'http://openhatch.org/people/paulproteus/'
         tc.go(make_twill_url(url))
         tc.follow('photo')
         tc.formfile('edit_photo', 'photo', image)
         tc.submit()
         # Now check that the photo is 200px wide
         p = Person.objects.get(user__username='paulproteus')
         image_as_stored = Image.open(p.photo.file)
         w, h = image_as_stored.size
         self.assertEqual(w, 200)
开发者ID:aishahalim,项目名称:OpenHatch,代码行数:14,代码来源:tests.py

示例8: change_password

    def change_password(self, old_pass, new_pass,
            should_succeed = True):
        tc.go(make_twill_url('http://openhatch.org/people/paulproteus'))
        tc.follow('settings')
        tc.follow('Password')
        tc.url('/account/settings/password')

        tc.fv('a_settings_tab_form', 'old_password', old_pass)
        tc.fv('a_settings_tab_form', 'new_password1', new_pass)
        tc.fv('a_settings_tab_form', 'new_password2', new_pass)
        tc.submit()

        # Try to log in with the new password now
        client = Client()
        username='paulproteus'
        success = client.login(username=username,
                password=new_pass)
        if should_succeed:
            success = success
        else:
            success = not success
        self.assert_(success)
开发者ID:boblannon,项目名称:oh-mainline,代码行数:22,代码来源:tests.py


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