本文整理汇总了Python中test_utils.RequestFactory.COOKIES['user']方法的典型用法代码示例。如果您正苦于以下问题:Python RequestFactory.COOKIES['user']方法的具体用法?Python RequestFactory.COOKIES['user']怎么用?Python RequestFactory.COOKIES['user']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test_utils.RequestFactory
的用法示例。
在下文中一共展示了RequestFactory.COOKIES['user']方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_session_auth
# 需要导入模块: from test_utils import RequestFactory [as 别名]
# 或者: from test_utils.RequestFactory import COOKIES['user'] [as 别名]
def test_session_auth(self):
req = RequestFactory().get('/')
req.COOKIES['user'] = ('[email protected],56b6f1a3dd735d962c56ce7d8f46e02ec'
'1d4748d2c00c407d75f0969d08bb9c68c31b3371aa8130'
'317815c89e5072e31bb94b4121c5c165f3515838d4d6c6'
'0c4,165d631d3c3045458b4516242dad7ae')
ok_(self.auth.is_authenticated(req))
示例2: test_single
# 需要导入模块: from test_utils import RequestFactory [as 别名]
# 或者: from test_utils.RequestFactory import COOKIES['user'] [as 别名]
def test_single(self):
req = RequestFactory().get('/')
req.COOKIES['user'] = ('[email protected],56b6f1a3dd735d962c56ce7d8f46e02ec'
'1d4748d2c00c407d75f0969d08bb9c68c31b3371aa8130'
'317815c89e5072e31bb94b4121c5c165f3515838d4d6c6'
'0c4,165d631d3c3045458b4516242dad7ae')
self.resource._meta.authentication = (
authentication.SharedSecretAuthentication())
eq_(self.resource.is_authenticated(req), None)
示例3: test_failed_session_auth
# 需要导入模块: from test_utils import RequestFactory [as 别名]
# 或者: from test_utils.RequestFactory import COOKIES['user'] [as 别名]
def test_failed_session_auth(self):
req = RequestFactory().get('/')
req.COOKIES['user'] = 'bogus'
ok_(not self.auth.is_authenticated(req))