本文整理汇总了Python中website.tokens.TokenHandler.from_payload方法的典型用法代码示例。如果您正苦于以下问题:Python TokenHandler.from_payload方法的具体用法?Python TokenHandler.from_payload怎么用?Python TokenHandler.from_payload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类website.tokens.TokenHandler
的用法示例。
在下文中一共展示了TokenHandler.from_payload方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_token_process_with_valid_action
# 需要导入模块: from website.tokens import TokenHandler [as 别名]
# 或者: from website.tokens.TokenHandler import from_payload [as 别名]
def test_token_process_with_valid_action(self, mock_handler):
self.payload['action'] = 'approve_registration_approval'
token = TokenHandler.from_payload(self.payload)
token.to_response()
assert_true(
mock_handler.called_with(
'registration',
'approve',
self.payload,
self.encoded_token
)
)
示例2: test_token_process_for_invalid_action_raises_TokenHandlerNotFound
# 需要导入模块: from website.tokens import TokenHandler [as 别名]
# 或者: from website.tokens.TokenHandler import from_payload [as 别名]
def test_token_process_for_invalid_action_raises_TokenHandlerNotFound(self):
self.payload['action'] = 'not a handler'
token = TokenHandler.from_payload(self.payload)
with assert_raises(TokenHandlerNotFound):
token.to_response()
示例3: test_from_payload
# 需要导入模块: from website.tokens import TokenHandler [as 别名]
# 或者: from website.tokens.TokenHandler import from_payload [as 别名]
def test_from_payload(self):
token = TokenHandler.from_payload(self.payload)
assert_equal(token.encoded_token, self.encoded_token)
assert_equal(token.payload, self.payload)