当前位置: 首页>>代码示例>>Python>>正文


Python Token.generate_token_challenge方法代码示例

本文整理汇总了Python中globaleaks.utils.token.Token.generate_token_challenge方法的典型用法代码示例。如果您正苦于以下问题:Python Token.generate_token_challenge方法的具体用法?Python Token.generate_token_challenge怎么用?Python Token.generate_token_challenge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在globaleaks.utils.token.Token的用法示例。


在下文中一共展示了Token.generate_token_challenge方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from globaleaks.utils.token import Token [as 别名]
# 或者: from globaleaks.utils.token.Token import generate_token_challenge [as 别名]
    def setUp(self):
        yield helpers.TestGL.setUp(self)

        pollute_events_for_testing()
        yield Alarm.compute_activity_level()

        # Token submission
        st = Token('submission')
        st.generate_token_challenge()
开发者ID:comradekingu,项目名称:GlobaLeaks,代码行数:11,代码来源:test_token.py

示例2: setUp

# 需要导入模块: from globaleaks.utils.token import Token [as 别名]
# 或者: from globaleaks.utils.token.Token import generate_token_challenge [as 别名]
    def setUp(self):
        yield helpers.TestGL.setUp(self)

        # This is at the beginning
        event.EventTrackQueue.reset()

        pollute_events_for_testing()
        yield anomaly.compute_activity_level()

        # Token submission
        st = Token('submission')
        st.generate_token_challenge()
开发者ID:br1n0,项目名称:GlobaLeaks,代码行数:14,代码来源:test_token.py

示例3: test_proof_of_work_right_answer

# 需要导入模块: from globaleaks.utils.token import Token [as 别名]
# 或者: from globaleaks.utils.token.Token import generate_token_challenge [as 别名]
    def test_proof_of_work_right_answer(self):
        token = Token('submission')

        difficulty = {
            'human_captcha': False,
            'graph_captcha': False,
            'proof_of_work': False
        }

        token.generate_token_challenge(difficulty)

        token = TokenList.get(token.id)
        # Note, this solution works with two '00' at the end, if the
        # difficulty changes, also this dummy value has to.
        token.proof_of_work = { 'question': "7GJ4Sl37AEnP10Zk9p7q" }

        # validate with right value: OK
        self.assertTrue(token.update({'proof_of_work_answer': 0}))
开发者ID:jpobley,项目名称:GlobaLeaks,代码行数:20,代码来源:test_token.py

示例4: test_proof_of_work_right_answer

# 需要导入模块: from globaleaks.utils.token import Token [as 别名]
# 或者: from globaleaks.utils.token.Token import generate_token_challenge [as 别名]
    def test_proof_of_work_right_answer(self):
        # This is at the beginning
        event.EventTrackQueue.reset()

        token = Token('submission')

        difficulty = {
            'human_captcha': False,
            'graph_captcha': False,
            'proof_of_work': False
        }

        token.generate_token_challenge(difficulty)

        token = TokenList.get(token.id)
        # Note, this solution works with two '00' at the end, if the
        # difficulty changes, also this dummy value has to.
        token.proof_of_work = { 'question': "7GJ4Sl37AEnP10Zk9p7q" }

        # validate with right value: OK
        self.assertFalse(token.update({'proof_of_work_answer': 26}))

        # verify that the challenge is marked as solved
        self.assertFalse(token.proof_of_work)
开发者ID:br1n0,项目名称:GlobaLeaks,代码行数:26,代码来源:test_token.py


注:本文中的globaleaks.utils.token.Token.generate_token_challenge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。