本文整理汇总了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;未经允许,请勿转载。 |
请发表评论