本文整理汇总了Python中privacyidea.models.Challenge.get_transaction_id方法的典型用法代码示例。如果您正苦于以下问题:Python Challenge.get_transaction_id方法的具体用法?Python Challenge.get_transaction_id怎么用?Python Challenge.get_transaction_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类privacyidea.models.Challenge
的用法示例。
在下文中一共展示了Challenge.get_transaction_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_12_challenge
# 需要导入模块: from privacyidea.models import Challenge [as 别名]
# 或者: from privacyidea.models.Challenge import get_transaction_id [as 别名]
def test_12_challenge(self):
c = Challenge("S123456")
self.assertTrue(len(c.transaction_id) == 20, c.transaction_id)
self.assertTrue(len(c.get_transaction_id()) == 20, c.transaction_id)
c.set_data("some data")
self.assertTrue(c.data == "some data", c.data)
self.assertTrue(c.get_data() == "some data", c.data)
c.set_data({"some": "data"})
self.assertTrue("some" in c.data, c.data)
c.set_session("session")
self.assertTrue(c.get_session() == "session", c.session)
c.set_challenge("challenge")
self.assertTrue(c.get_challenge() == "challenge", c.challenge)
self.assertTrue("otp_received" in "{0!s}".format(c), "{0!s}".format(c))
self.assertTrue("transaction_id" in "{0!s}".format(c), "{0!s}".format(c))
self.assertTrue("timestamp" in "{0!s}".format(c), "{0!s}".format(c))
# test with timestamp=True, which results in something like this:
timestamp = '2014-11-29 21:56:43.057293'
self.assertTrue(len(c.get(True).get("timestamp")) == len(timestamp),
c.get(True))
# otp_status
c.set_otp_status(valid=False)
self.assertTrue(c.get_otp_status()[0], c.get_otp_status())
self.assertFalse(c.get_otp_status()[1], c.get_otp_status())