本文整理汇总了Python中utils.flare.Flare._strip_credentials方法的典型用法代码示例。如果您正苦于以下问题:Python Flare._strip_credentials方法的具体用法?Python Flare._strip_credentials怎么用?Python Flare._strip_credentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.flare.Flare
的用法示例。
在下文中一共展示了Flare._strip_credentials方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_api_keys_regex
# 需要导入模块: from utils.flare import Flare [as 别名]
# 或者: from utils.flare.Flare import _strip_credentials [as 别名]
def test_api_keys_regex(self, mock_config, mock_tempdir, mock_strftime):
f = Flare()
file_path, _ = f._strip_credentials(
os.path.join(get_mocked_temp(), 'apikeys.conf'),
f.MAIN_CREDENTIALS
)
with open(file_path) as f:
contents = f.read()
self.assertEqual(
contents,
"api_key: **************************aaaaa, **************************bbbbb,"
" **************************ccccc, **************************ddddd\n"
)
f = Flare()
file_path, _ = f._strip_credentials(
os.path.join(get_mocked_temp(), 'apikey.conf'),
f.MAIN_CREDENTIALS
)
with open(file_path) as f:
contents = f.read()
self.assertEqual(
contents,
"api_key: **************************aaaaa\n"
)
示例2: test_uri_password
# 需要导入模块: from utils.flare import Flare [as 别名]
# 或者: from utils.flare.Flare import _strip_credentials [as 别名]
def test_uri_password(self, mock_config, mock_tempdir, mock_strftime):
f = Flare()
_, credentials_log = f._strip_credentials(
os.path.join(get_mocked_temp(), mock_cfgs['uri_password']),
f.CHECK_CREDENTIALS
)
self.assertEqual(
credentials_log,
" - this file contains a credential (password in a uri) which has been removed in the collected version"
)
示例3: test_whitespace_proxy_user_pass_regex
# 需要导入模块: from utils.flare import Flare [as 别名]
# 或者: from utils.flare.Flare import _strip_credentials [as 别名]
def test_whitespace_proxy_user_pass_regex(self, mock_config, mock_tempdir, mock_strftime, mock_os_remove):
f = Flare()
file_path, _ = f._strip_credentials(
os.path.join(get_mocked_temp(), 'whitespace_proxy.conf'),
f.MAIN_CREDENTIALS
)
with open(file_path) as f:
contents = f.read()
self.assertEqual(
contents,
"proxy_user: ********\n"
"proxy_password: ********\n"
)