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

Python base.assert_is_redirect函数代码示例

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

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



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

示例1: test_dropbox_oauth_finish

 def test_dropbox_oauth_finish(self, mock_get, mock_finish):
     mock_client = mock.MagicMock()
     mock_client.account_info.return_value = {'display_name': 'Mr. Drop Box'}
     mock_get.return_value = mock_client
     mock_finish.return_value = ('mytoken123', 'mydropboxid', 'done')
     url = api_url_for('dropbox_oauth_finish')
     res = self.app.get(url)
     assert_is_redirect(res)
开发者ID:AndrewSallans,项目名称:osf.io,代码行数:8,代码来源:test_views.py


示例2: test_must_be_contributor_no_user

 def test_must_be_contributor_no_user(self):
     res = view_that_needs_contributor(
         pid=self.project._primary_key,
         user=None,
         api_key='123',
         api_node='abc',
     )
     assert_is_redirect(res)
     redirect_url = res.headers['Location']
     assert_equal(redirect_url, '/login/?next=/')
开发者ID:erinmayhood,项目名称:osf.io,代码行数:10,代码来源:test_auth.py


示例3: test_must_be_contributor_no_user_and_private_project

 def test_must_be_contributor_no_user_and_private_project(self):
     res = view_that_needs_contributor_or_public_but_not_anonymized(
         pid=self.private_project._primary_key,
         user=None,
     )
     assert_is_redirect(res)
     # redirects to login url
     redirect_url = res.headers['Location']
     login_url = cas.get_login_url(service_url='http://localhost/')
     assert_equal(redirect_url, login_url)
开发者ID:CenterForOpenScience,项目名称:osf.io,代码行数:10,代码来源:test_auth.py


示例4: test_googledrive_oauth_finish_cancelled

 def test_googledrive_oauth_finish_cancelled(self):
     user_no_addon = AuthUserFactory()
     url = api_url_for(
         'googledrive_oauth_finish',
         user_no_addon.auth,
         nid=self.project._primary_key,
         code='1234',
         state='3322',
         error='User declined!'
     )
     res = self.app.get(url)
     assert_is_redirect(res)
开发者ID:XTech2K,项目名称:osf.io,代码行数:12,代码来源:test_views.py


示例5: test_box_oauth_finish

 def test_box_oauth_finish(self, mock_get, mock_finish, mock_oauth):
     mock_client = mock.MagicMock()
     mock_client.get_user_info.return_value = {'name': 'Mr. Box', 'id': '1234567890'}
     mock_get.return_value = mock_client
     mock_finish.return_value = {
         'token_type': 'something',
         'access_token': 'something',
         'refresh_token': 'something'
     }
     mock_oauth.return_value = ('mytoken123', 'myboxid', 'done')
     url = api_url_for('box_oauth_finish')
     res = self.app.get(url)
     assert_is_redirect(res)
开发者ID:GageGaskins,项目名称:osf.io,代码行数:13,代码来源:test_views.py


示例6: test_dropbox_oauth_finish_cancelled

    def test_dropbox_oauth_finish_cancelled(self, mock_finish, mock_session):
        node = ProjectFactory(creator=self.user)
        mock_session.data = {'dropbox_auth_nid': node._id}
        mock_response = mock.Mock()
        mock_response.status = 404
        mock_finish.side_effect = DropboxOAuth2Flow.NotApprovedException
        settings = self.user.get_addon('dropbox')
        url = api_url_for('dropbox_oauth_finish')
        res = self.app.get(url)

        assert_is_redirect(res)
        assert_in(node._id, res.headers["location"])
        assert_false(settings)
开发者ID:KerryKDiehl,项目名称:osf.io,代码行数:13,代码来源:test_views.py


示例7: test_googledrive_oauth_finish_user_only

 def test_googledrive_oauth_finish_user_only(self, mock_session, mock_auth_client_finish, mock_auth_client_userinfo):
     user_no_addon = AuthUserFactory()
     state = "1234"
     mock_session.data = {"googledrive_auth_state": state}
     mock_auth_client_finish.return_value = {
         "access_token": "1111",
         "refresh_token": "2222",
         "expires_at": time.time() + 3600,
     }
     mock_auth_client_userinfo.return_value = {"sub": "unique id", "name": "test-user"}
     url = api_url_for("googledrive_oauth_finish", user_no_addon.auth, code="1234", state=state)
     res = self.app.get(url)
     assert_is_redirect(res)
开发者ID:jinluyuan,项目名称:osf.io,代码行数:13,代码来源:test_views.py


示例8: test_googledrive_oauth_finish_cancelled

 def test_googledrive_oauth_finish_cancelled(self, mock_flash):
     user_no_addon = AuthUserFactory()
     url = api_url_for(
         "googledrive_oauth_finish",
         user_no_addon.auth,
         nid=self.project._primary_key,
         code="1234",
         state="3322",
         error="User declined!",
     )
     res = self.app.get(url)
     assert_is_redirect(res)
     mock_flash.assert_called_once()
开发者ID:jinluyuan,项目名称:osf.io,代码行数:13,代码来源:test_views.py


示例9: test_googledrive_oauth_finish_user_only

 def test_googledrive_oauth_finish_user_only(self, mock_session, mock_auth_client_finish, mock_auth_client_userinfo):
     user_no_addon = AuthUserFactory()
     state = '1234'
     mock_session.data = {
         'googledrive_auth_state': state,
     }
     mock_auth_client_finish.return_value = {
         'access_token': '1111',
         'refresh_token': '2222',
         'expires_at': time.time() + 3600,
     }
     mock_auth_client_userinfo.return_value = {
         'sub': 'unique id',
         'name': 'test-user',
     }
     url = api_url_for('googledrive_oauth_finish', user_no_addon.auth, code='1234', state=state)
     res = self.app.get(url)
     assert_is_redirect(res)
开发者ID:KerryKDiehl,项目名称:osf.io,代码行数:18,代码来源:test_views.py


示例10: test_does_not_have_key

 def test_does_not_have_key(self, mock_from_kwargs):
     mock_from_kwargs.return_value = Auth(user=None)
     res = self.app.get('/project/{0}'.format(self.project._primary_key),
         {'key': None})
     assert_is_redirect(res)
开发者ID:erinmayhood,项目名称:osf.io,代码行数:5,代码来源:test_auth.py


示例11: test_dropbox_oauth_start

 def test_dropbox_oauth_start(self):
     url = api_url_for('dropbox_oauth_start_user')
     res = self.app.get(url)
     assert_is_redirect(res)
     assert_in('&force_reapprove=true', res.location)
开发者ID:AndrewSallans,项目名称:osf.io,代码行数:5,代码来源:test_views.py


示例12: test_box_oauth_finish_cancelled

 def test_box_oauth_finish_cancelled(self, mock_flash):
     url = api_url_for('box_oauth_finish', error='User declined!')
     res = self.app.get(url)
     assert_is_redirect(res)
     mock_flash.assert_called_once()
开发者ID:GageGaskins,项目名称:osf.io,代码行数:5,代码来源:test_views.py


示例13: test_box_oauth_start

 def test_box_oauth_start(self):
     url = api_url_for('box_oauth_start_user')
     res = self.app.get(url)
     assert_is_redirect(res)
开发者ID:GageGaskins,项目名称:osf.io,代码行数:4,代码来源:test_views.py


示例14: test_menbib_oauth_finish

 def test_menbib_oauth_finish(self, mock_finish):
     mock_finish.return_value = AuthResult('mytokenabc', 'myrefreshabc', 'cool', '3600')
     url = api_url_for('menbib_oauth_finish')
     res = self.app.get(url)
     assert_is_redirect(res)
开发者ID:retroam,项目名称:menbib,代码行数:5,代码来源:test_views.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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