本文整理汇总了Python中ccvpn.tests.DummyRequest.matchdict['token']方法的典型用法代码示例。如果您正苦于以下问题:Python DummyRequest.matchdict['token']方法的具体用法?Python DummyRequest.matchdict['token']怎么用?Python DummyRequest.matchdict['token']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ccvpn.tests.DummyRequest
的用法示例。
在下文中一共展示了DummyRequest.matchdict['token']方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_valid
# 需要导入模块: from ccvpn.tests import DummyRequest [as 别名]
# 或者: from ccvpn.tests.DummyRequest import matchdict['token'] [as 别名]
def test_valid(self):
req = DummyRequest(post={
'password': 'newpw',
'password2': 'newpw',
})
req.matchdict['token'] = self.token.token
req.remote_addr = '127.0.0.1'
resp = views.account.reset(req)
self.assertIsInstance(resp, httpexceptions.HTTPMovedPermanently)
self.assertTrue(resp.location.endswith('/account/login'))
registry = self.config.registry
mailer = get_mailer(registry)
self.assertEqual(len(mailer.outbox), 1)
# Should not be able to use a token > 1 time
req = DummyRequest(post={
'password': 'newpw',
'password2': 'newpw',
})
req.matchdict['token'] = self.token.token
req.remote_addr = '127.0.0.1'
resp = views.account.reset(req)
self.assertIsInstance(resp, httpexceptions.HTTPMovedPermanently)
self.assertTrue(resp.location.endswith('/account/forgot'))
registry = self.config.registry
mailer = get_mailer(registry)
self.assertEqual(len(mailer.outbox), 1)
示例2: test_form
# 需要导入模块: from ccvpn.tests import DummyRequest [as 别名]
# 或者: from ccvpn.tests.DummyRequest import matchdict['token'] [as 别名]
def test_form(self):
req = DummyRequest()
req.matchdict['token'] = self.token.token
req.remote_addr = '127.0.0.1'
resp = views.account.reset(req)
self.assertEqual(req.response.status_code, 200)
self.assertIsInstance(resp, dict)
req = DummyRequest(post={})
req.matchdict['token'] = self.token.token
req.remote_addr = '127.0.0.1'
resp = views.account.reset(req)
self.assertEqual(req.response.status_code, 200)
self.assertIsInstance(resp, dict)
示例3: test_invalid_password
# 需要导入模块: from ccvpn.tests import DummyRequest [as 别名]
# 或者: from ccvpn.tests.DummyRequest import matchdict['token'] [as 别名]
def test_invalid_password(self):
req = DummyRequest(post={
'password': 'pw',
'password2': 'notpw'
})
req.matchdict['token'] = self.token.token
req.remote_addr = '127.0.0.1'
resp = views.account.reset(req)
self.assertEqual(req.response.status_code, 400)
self.assertIsInstance(resp, dict)
示例4: test_invalid_token
# 需要导入模块: from ccvpn.tests import DummyRequest [as 别名]
# 或者: from ccvpn.tests.DummyRequest import matchdict['token'] [as 别名]
def test_invalid_token(self):
req = DummyRequest()
req.matchdict['token'] = 'invalidtoken'
req.remote_addr = '127.0.0.1'
resp = views.account.reset(req)
self.assertIsInstance(resp, httpexceptions.HTTPMovedPermanently)