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


Python RunResult.stdout方法代码示例

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


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

示例1: test_groups

# 需要导入模块: from bundlewrap.operations import RunResult [as 别名]
# 或者: from bundlewrap.operations.RunResult import stdout [as 别名]
    def test_groups(self, _groups_for_user):
        _groups_for_user.return_value = ["group1", "group3"]
        bundle = MagicMock()
        user = users.User(
            bundle,
            "bundlewrap",
            {
                'full_name': "Blöck Wart",
                'gid': 2345,
                'groups': ["group1", "group2"],
                'home': "/home/bundlewrap",
                'password_hash': "secret",
                'shell': "/bin/bash",
                'uid': 1123,
            },
        )

        passwd_grep_result = RunResult()
        passwd_grep_result.return_code = 0
        passwd_grep_result.stdout = "bundlewrap:x:1123:2345:Blöck Wart:/home/bundlewrap:/bin/bash\n"
        shadow_grep_result = RunResult()
        shadow_grep_result.return_code = 0
        shadow_grep_result.stdout = "bundlewrap:secret:::::::"
        results = [shadow_grep_result, passwd_grep_result]

        def pop_result(*args, **kwargs):
            return results.pop()

        bundle.node.run.side_effect = pop_result

        status = user.get_status()
        self.assertFalse(status.correct)
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:34,代码来源:users_tests.py

示例2: test_installed

# 需要导入模块: from bundlewrap.operations import RunResult [as 别名]
# 或者: from bundlewrap.operations.RunResult import stdout [as 别名]
 def test_installed(self):
     runresult = RunResult()
     runresult.return_code = 0
     runresult.stdout = "Status: install ok installed\n"
     node = MagicMock()
     node.run.return_value = runresult
     self.assertTrue(pkg_apt.pkg_installed(node, "foo"))
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:9,代码来源:pkg_apt_tests.py

示例3: test_running

# 需要导入模块: from bundlewrap.operations import RunResult [as 别名]
# 或者: from bundlewrap.operations.RunResult import stdout [as 别名]
 def test_running(self):
     runresult = RunResult()
     runresult.return_code = 0
     runresult.stdout = "foo start/running, process 1234\n"
     node = MagicMock()
     node.run.return_value = runresult
     self.assertTrue(svc_upstart.svc_running(node, "foo"))
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:9,代码来源:svc_upstart_tests.py

示例4: test_installed

# 需要导入模块: from bundlewrap.operations import RunResult [as 别名]
# 或者: from bundlewrap.operations.RunResult import stdout [as 别名]
 def test_installed(self):
     runresult = RunResult()
     runresult.return_code = 0
     runresult.stdout = "foo 1.0.0-1\n"
     node = MagicMock()
     node.run.return_value = runresult
     self.assertTrue(pkg_pacman.pkg_installed(node, "foo"))
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:9,代码来源:pkg_pacman_tests.py

示例5: test_not_installed

# 需要导入模块: from bundlewrap.operations import RunResult [as 别名]
# 或者: from bundlewrap.operations.RunResult import stdout [as 别名]
 def test_not_installed(self):
     runresult = RunResult()
     runresult.return_code = 1
     runresult.stdout = "error: package 'foo' was not found"
     node = MagicMock()
     node.run.return_value = runresult
     self.assertFalse(pkg_pacman.pkg_installed(node, "foo"))
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:9,代码来源:pkg_pacman_tests.py

示例6: test_not_installed

# 需要导入模块: from bundlewrap.operations import RunResult [as 别名]
# 或者: from bundlewrap.operations.RunResult import stdout [as 别名]
 def test_not_installed(self):
     runresult = RunResult()
     runresult.return_code = 1
     runresult.stdout = "Error: No matching Packages to list\n"
     node = MagicMock()
     node.run.return_value = runresult
     self.assertFalse(pkg_yum.pkg_installed(node, "foo"))
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:9,代码来源:pkg_yum_tests.py

示例7: test_not_running

# 需要导入模块: from bundlewrap.operations import RunResult [as 别名]
# 或者: from bundlewrap.operations.RunResult import stdout [as 别名]
 def test_not_running(self):
     runresult = RunResult()
     runresult.return_code = 3
     runresult.stdout = "whatever, does not matter"
     node = MagicMock()
     node.run.return_value = runresult
     self.assertFalse(svc_systemd.svc_running(node, "foo"))
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:9,代码来源:svc_systemd_tests.py

示例8: test_not_installed

# 需要导入模块: from bundlewrap.operations import RunResult [as 别名]
# 或者: from bundlewrap.operations.RunResult import stdout [as 别名]
 def test_not_installed(self):
     runresult = RunResult()
     runresult.return_code = 1
     runresult.stdout = (
         "Package `foo' is not installed and no info is available.\n"
         "Use dpkg --info (= dpkg-deb --info) to examine archive files,\n"
         "and dpkg --contents (= dpkg-deb --contents) to list their contents.\n"
     )
     node = MagicMock()
     node.run.return_value = runresult
     self.assertFalse(pkg_apt.pkg_installed(node, "foo"))
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:13,代码来源:pkg_apt_tests.py

示例9: test_short_mode

# 需要导入模块: from bundlewrap.operations import RunResult [as 别名]
# 或者: from bundlewrap.operations.RunResult import stdout [as 别名]
 def test_short_mode(self):
     node = MagicMock()
     run_result = RunResult()
     run_result.stdout = "user:group:666:4321"
     node.run.return_value = run_result
     stat_result = remote.stat(node, "/dev/null")
     self.assertEqual(stat_result, {
         'owner': "user",
         'group': "group",
         'mode': "0666",
         'size': 4321,
     })
开发者ID:mfriedenhagen,项目名称:bundlewrap,代码行数:14,代码来源:remote_tests.py

示例10: test_long_mode

# 需要导入模块: from bundlewrap.operations import RunResult [as 别名]
# 或者: from bundlewrap.operations.RunResult import stdout [as 别名]
 def test_long_mode(self):
     node = MagicMock()
     run_result = RunResult()
     run_result.stdout = "user:group:7777:1234"
     node.run.return_value = run_result
     stat_result = remote.stat(node, "/dev/null")
     self.assertEqual(stat_result, {
         'owner': "user",
         'group': "group",
         'mode': "7777",
         'size': 1234,
     })
开发者ID:mfriedenhagen,项目名称:bundlewrap,代码行数:14,代码来源:remote_tests.py

示例11: test_gid

# 需要导入模块: from bundlewrap.operations import RunResult [as 别名]
# 或者: from bundlewrap.operations.RunResult import stdout [as 别名]
    def test_gid(self):
        bundle = MagicMock()
        group = groups.Group(
            bundle,
            "bundlewrap",
            { 'gid': 2345 },
        )

        grep_result = RunResult()
        grep_result.return_code = 0
        grep_result.stdout = "bundlewrap:x:5432:user1,user2\n"

        bundle.node.run.return_value = grep_result

        status = group.get_status()
        self.assertFalse(status.correct)
开发者ID:mfriedenhagen,项目名称:bundlewrap,代码行数:18,代码来源:groups_tests.py

示例12: test_delete

# 需要导入模块: from bundlewrap.operations import RunResult [as 别名]
# 或者: from bundlewrap.operations.RunResult import stdout [as 别名]
    def test_delete(self):
        bundle = MagicMock()
        user = users.User(
            bundle,
            "bundlewrap",
            {'delete': True},
        )

        passwd_grep_result = RunResult()
        passwd_grep_result.return_code = 0
        passwd_grep_result.stdout = "bundlewrap:x:1123:2345:Blöck Wart:/home/bundlewrap:/bin/bash\n"

        bundle.node.run.return_value = passwd_grep_result

        status = user.get_status()
        self.assertFalse(status.correct)
        self.assertTrue(status.info['exists'])
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:19,代码来源:users_tests.py

示例13: test_not_running

# 需要导入模块: from bundlewrap.operations import RunResult [as 别名]
# 或者: from bundlewrap.operations.RunResult import stdout [as 别名]
 def test_not_running(self):
     runresult = RunResult()
     runresult.stdout = "foo stop/waiting\n"
     node = MagicMock()
     node.run.return_value = runresult
     self.assertFalse(svc_upstart.svc_running(node, "foo"))
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:8,代码来源:svc_upstart_tests.py


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