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


Python operations.RunResult类代码示例

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


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

示例1: test_not_running

 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,代码行数:7,代码来源:svc_systemd_tests.py

示例2: test_not_installed

 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,代码行数:7,代码来源:pkg_yum_tests.py

示例3: test_running

 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,代码行数:7,代码来源:svc_upstart_tests.py

示例4: test_shadow_fail

    def test_shadow_fail(self, _groups_for_user):
        _groups_for_user.return_value = ["group1", "group2"]
        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 = 1
        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)
        self.assertEqual(status.info['shadow_hash'], None)
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:32,代码来源:users_tests.py

示例5: test_installed

 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,代码行数:7,代码来源:pkg_apt_tests.py

示例6: test_installed

 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,代码行数:7,代码来源:pkg_pacman_tests.py

示例7: test_not_installed

 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,代码行数:7,代码来源:pkg_pacman_tests.py

示例8: test_locked

 def test_locked(self, ask_interactively):
     node = MagicMock()
     runres = RunResult()
     runres.return_code = 1
     node.run.return_value = runres
     with self.assertRaises(NodeAlreadyLockedException):
         with NodeLock(node, False, ignore=False):
             pass
开发者ID:mfriedenhagen,项目名称:bundlewrap,代码行数:8,代码来源:node_tests.py

示例9: test_not_installed

 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,代码行数:11,代码来源:pkg_apt_tests.py

示例10: test_long_mode

 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,代码行数:12,代码来源:remote_tests.py

示例11: test_short_mode

 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,代码行数:12,代码来源:remote_tests.py

示例12: test_gid

    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,代码行数:16,代码来源:groups_tests.py

示例13: test_group_fail

    def test_group_fail(self):
        bundle = MagicMock()
        group = groups.Group(
            bundle,
            "bundlewrap",
            { 'gid': 2345 },
        )

        grep_result = RunResult()
        grep_result.return_code = 1

        bundle.node.run.return_value = grep_result

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

示例14: test_groups

    def test_groups(self):
        node = MagicMock()
        result1 = RunResult()
        result1.stdout = "group1 group2\n"
        result2 = RunResult()
        result2.stdout = "group1\n"
        results = [result2, result1]

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

        node.run.side_effect = get_result

        groups = users._groups_for_user(node, "jdoe")

        self.assertEqual(groups, ["group2"])
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:16,代码来源:users_tests.py

示例15: test_delete

    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,代码行数:17,代码来源:users_tests.py


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