本文整理汇总了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))
示例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))
示例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())
示例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))
示例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)
示例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)
示例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()
示例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(),
)
示例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(),
)
示例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())
示例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')