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


Python utils.assert_contains函数代码示例

本文整理汇总了Python中utils.assert_contains函数的典型用法代码示例。如果您正苦于以下问题:Python assert_contains函数的具体用法?Python assert_contains怎么用?Python assert_contains使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_error_includes_stderr_if_given_and_hidden

 def test_error_includes_stderr_if_given_and_hidden(self):
     """
     error() correctly prints stderr if it was previously hidden
     """
     # Mostly to catch regression bug(s)
     stderr = "this is my stderr"
     with hide('stderr'):
         error("error message", func=utils.abort, stderr=stderr)
     assert_contains(stderr, sys.stderr.getvalue())
开发者ID:4hr1m4n,项目名称:fabric,代码行数:9,代码来源:test_utils.py

示例2: test_password_prompt_displays_host_string

 def test_password_prompt_displays_host_string(self):
     """
     Password prompt lines should include the user/host in question
     """
     env.password = None
     env.no_agent = env.no_keys = True
     with show('everything'), password_response(PASSWORDS[env.user], silent=False):
         run("ls /simple")
     regex = r'^\[%s\] Login password for \'%s\': ' % (env.host_string, env.user)
     assert_contains(regex, sys.stderr.getvalue())
开发者ID:ScorpionResponse,项目名称:fabric,代码行数:10,代码来源:test_network.py

示例3: test_passphrase_prompt_displays_host_string

 def test_passphrase_prompt_displays_host_string(self):
     """
     Passphrase prompt lines should include the user/host in question
     """
     env.password = None
     env.no_agent = env.no_keys = True
     env.key_filename = CLIENT_PRIVKEY
     with hide('everything'), password_response(CLIENT_PRIVKEY_PASSPHRASE, silent=False):
         run("ls /simple")
     regex = r'^\[%s\] Login password for \'%s\': ' % (env.host_string, env.user)
     assert_contains(regex, sys.stderr.getvalue())
开发者ID:ScorpionResponse,项目名称:fabric,代码行数:11,代码来源:test_network.py

示例4: _invalid_file_obj_situations

 def _invalid_file_obj_situations(self, remote_path):
     with settings(hide('running'), warn_only=True):
         get(remote_path, StringIO())
     assert_contains('is a glob or directory', sys.stderr.getvalue())
开发者ID:itsmeallan,项目名称:fabric,代码行数:4,代码来源:test_operations.py

示例5: test_includes_traceback_if_debug_logging_is_on

 def test_includes_traceback_if_debug_logging_is_on(self):
     """
     error() includes traceback in message if debug logging is on (backwardis compatibility)
     """
     error("error message", func=utils.abort, stdout=error)
     assert_contains(self.dummy_string, sys.stdout.getvalue())
开发者ID:4hr1m4n,项目名称:fabric,代码行数:6,代码来源:test_utils.py

示例6: test_includes_traceback_if_exceptions_logging_is_on

 def test_includes_traceback_if_exceptions_logging_is_on(self):
     """
     error() includes traceback in message if exceptions logging is on
     """
     error("error message", func=utils.abort, stdout=error)
     assert_contains(self.dummy_string, sys.stdout.getvalue())
开发者ID:4hr1m4n,项目名称:fabric,代码行数:6,代码来源:test_utils.py

示例7: print_header

#
print_header("3.2 Remove X Windows (Scored)")
# Original CIS test
# check_equal(
#     'grep "^id:" /etc/inittab',
#     "id:3:initdefault"
# )
# Syco hardened servers use this.
check_equal(
    'grep "^\~\~\:S\:wait\:\/sbin\/sulogin" /etc/inittab',
    "~~:S:wait:/sbin/sulogin"
)

result = x('yum grouplist "X Window System"')
max_lines = len(result)
assert_contains(result[max_lines-3], "Available Groups:")
assert_contains(result[max_lines-2], "  X Window System")
assert_contains(result[max_lines-1], "Done")

#
print_header("3.3 Disable Avahi Server (Scored)")
check_equal(
    "rpm -q avahi",
    "package avahi is not installed"
)
check_empty("chkconfig --list | grep avahi")

#
print_header("3.4 Disable Print Server - CUPS (Not Scored)")
check_equal(
    "rpm -q cups",
开发者ID:Nemie,项目名称:syco,代码行数:31,代码来源:cis3.py


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