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


Python Secret.set方法代码示例

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


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

示例1: test_non_matching_digests_should_return_false

# 需要导入模块: from app.util.secret import Secret [as 别名]
# 或者: from app.util.secret.Secret import set [as 别名]
    def test_non_matching_digests_should_return_false(self):
        secret = 'secrettoken'
        message = 'message blah blah horse battery staple'
        Secret.set(secret)
        digest_received = Secret._get_hex_digest('not the original message', secret)

        self.assertFalse(Secret.digest_is_valid(digest_received, message))
开发者ID:drobertduke,项目名称:ClusterRunner,代码行数:9,代码来源:test_secret.py

示例2: test_unspecified_digest_should_return_false

# 需要导入模块: from app.util.secret import Secret [as 别名]
# 或者: from app.util.secret.Secret import set [as 别名]
    def test_unspecified_digest_should_return_false(self):
        secret = 'secrettoken'
        message = 'message blah blah horse battery staple'
        Secret.set(secret)
        digest_received = None

        self.assertFalse(Secret.digest_is_valid(digest_received, message))
开发者ID:drobertduke,项目名称:ClusterRunner,代码行数:9,代码来源:test_secret.py

示例3: setUp

# 需要导入模块: from app.util.secret import Secret [as 别名]
# 或者: from app.util.secret.Secret import set [as 别名]
    def setUp(self):
        # Configure logging to go to stdout. This makes debugging easier by allowing us to see logs for failed tests.
        log.configure_logging('DEBUG')

        Secret.set('testsecret')

        self.cluster = FunctionalTestCluster(verbose=self._get_test_verbosity())
开发者ID:fengshao0907,项目名称:ClusterRunner,代码行数:9,代码来源:base_functional_test_case.py

示例4: test_matching_digests_should_return_true

# 需要导入模块: from app.util.secret import Secret [as 别名]
# 或者: from app.util.secret.Secret import set [as 别名]
    def test_matching_digests_should_return_true(self):
        secret = 'secrettoken'
        message = 'message blah blah horse battery staple'
        Secret.set(secret)
        digest_received = Secret._get_hex_digest(message, secret)

        self.assertTrue(Secret.digest_is_valid(digest_received, message))
开发者ID:drobertduke,项目名称:ClusterRunner,代码行数:9,代码来源:test_secret.py

示例5: _set_secret

# 需要导入模块: from app.util.secret import Secret [as 别名]
# 或者: from app.util.secret.Secret import set [as 别名]
def _set_secret(config_filename):
    if 'secret' in Configuration and Configuration['secret'] is not None:
        secret = Configuration['secret']
    else:  # No secret found, generate one and persist it
        secret = hashlib.sha512().hexdigest()
        conf_file = ConfigFile(config_filename)
        conf_file.write_value('secret', secret, BASE_CONFIG_FILE_SECTION)
    Secret.set(secret)
开发者ID:Medium,项目名称:ClusterRunner,代码行数:10,代码来源:main.py

示例6: _set_secret

# 需要导入模块: from app.util.secret import Secret [as 别名]
# 或者: from app.util.secret.Secret import set [as 别名]
def _set_secret(config_filename):
    if 'secret' in Configuration and Configuration['secret'] is not None:
        secret = Configuration['secret']
    else:  # No secret found, generate one and persist it
        secret_length = 128
        chars = string.ascii_lowercase + string.digits
        secret = ''.join(random.SystemRandom().choice(chars) for _ in range(secret_length))
        conf_file = ConfigFile(config_filename)
        conf_file.write_value('secret', secret, BASE_CONFIG_FILE_SECTION)
    Secret.set(secret)
开发者ID:box,项目名称:ClusterRunner,代码行数:12,代码来源:__main__.py

示例7: setUp

# 需要导入模块: from app.util.secret import Secret [as 别名]
# 或者: from app.util.secret.Secret import set [as 别名]
    def setUp(self):
        # Configure logging to go to stdout. This makes debugging easier by allowing us to see logs for failed tests.
        log.configure_logging('DEBUG')

        self._reset_config()
        Secret.set('testsecret')
        SlaveRegistry.reset_singleton()

        self.cluster = FunctionalTestCluster(verbose=self._get_test_verbosity())
        self._network = Network()
开发者ID:box,项目名称:ClusterRunner,代码行数:12,代码来源:base_functional_test_case.py

示例8: setUp

# 需要导入模块: from app.util.secret import Secret [as 别名]
# 或者: from app.util.secret.Secret import set [as 别名]
    def setUp(self):
        # Configure logging to go to stdout. This makes debugging easier by allowing us to see logs for failed tests.
        log.configure_logging('DEBUG')

        Secret.set('testsecret')
        self.test_app_base_dir = tempfile.TemporaryDirectory()

        self.test_conf_file_path = self._create_test_config_file({
            'secret': Secret.get(),
            'base_directory': self.test_app_base_dir.name,
        })

        self.cluster = FunctionalTestCluster(
            conf_file_path=self.test_conf_file_path,
            verbose=self._get_test_verbosity(),
        )
开发者ID:drobertduke,项目名称:ClusterRunner,代码行数:18,代码来源:base_functional_test_case.py

示例9: setUp

# 需要导入模块: from app.util.secret import Secret [as 别名]
# 或者: from app.util.secret.Secret import set [as 别名]
    def setUp(self):
        # Configure logging to go to stdout. This makes debugging easier by allowing us to see logs for failed tests.
        log.configure_logging('DEBUG')

        Secret.set('testsecret')
        self.test_app_base_dir = tempfile.TemporaryDirectory()

        self.test_conf_file_path = self._create_test_config_file({
            'secret': Secret.get(),
            'base_directory': self.test_app_base_dir.name,
            # Set the max log file size to a low value so that we cause  at least one rollover during the test.
            'max_log_file_size': 1024 * 5,
        })

        self.cluster = FunctionalTestCluster(
            conf_file_path=self.test_conf_file_path,
            verbose=self._get_test_verbosity(),
        )
开发者ID:dncarley,项目名称:ClusterRunner,代码行数:20,代码来源:base_functional_test_case.py

示例10: test_get_secret_should_return_set_secret

# 需要导入模块: from app.util.secret import Secret [as 别名]
# 或者: from app.util.secret.Secret import set [as 别名]
 def test_get_secret_should_return_set_secret(self):
     secret = 'secret1234'
     Secret.set(secret)
     self.assertEqual(secret, Secret.get())
开发者ID:drobertduke,项目名称:ClusterRunner,代码行数:6,代码来源:test_secret.py

示例11: secret_setter

# 需要导入模块: from app.util.secret import Secret [as 别名]
# 或者: from app.util.secret.Secret import set [as 别名]
 def secret_setter(*args):
     Secret.set('mellon1234')
开发者ID:manishas,项目名称:ClusterRunner,代码行数:4,代码来源:test_main.py


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