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


Python MagicMock.info方法代码示例

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


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

示例1: test_stop

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
 def test_stop(self):
     svc = svc_upstart.SvcUpstart(MagicMock(), "foo", {'running': False})
     status = MagicMock()
     status.info = {'running': True}
     self.assertEqual(
         svc.ask(status),
         "status running → not running\n",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:10,代码来源:svc_upstart_tests.py

示例2: test_remove

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
 def test_remove(self):
     pkg = pkg_apt.AptPkg(MagicMock(), "foo", {'installed': False})
     status = MagicMock()
     status.info = {'installed': True}
     self.assertEqual(
         pkg.ask(status),
         "status installed → not installed\n",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:10,代码来源:pkg_apt_tests.py

示例3: test_install

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
 def test_install(self):
     pkg = pkg_pacman.PacmanPkg(MagicMock(), "foo", {'installed': True})
     status = MagicMock()
     status.info = {'installed': False}
     self.assertEqual(
         pkg.ask(status),
         "status not installed → installed\n",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:10,代码来源:pkg_pacman_tests.py

示例4: test_install

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
 def test_install(self):
     pkg = pkg_pip.PipPkg(MagicMock(), "foo", {'installed': True})
     status = MagicMock()
     status.info = {'installed': False, 'version': None}
     self.assertEqual(
         pkg.ask(status),
         "status not installed → installed\n",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:10,代码来源:pkg_pip_tests.py

示例5: test_remove

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
 def test_remove(self):
     pkg = pkg_pip.PipPkg(MagicMock(), "foo", {'installed': False})
     status = MagicMock()
     status.info = {'installed': True, 'version': "1.0"}
     self.assertEqual(
         pkg.ask(status),
         "status 1.0 → not installed\n",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:10,代码来源:pkg_pip_tests.py

示例6: test_create

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
 def test_create(self):
     db = postgres_dbs.PostgresDB(MagicMock(), "foo", {'owner': "bar"})
     status = MagicMock()
     status.info = {'exists': False, 'needs_fixing': ['existence']}
     self.assertEqual(
         db.ask(status),
         "Doesn't exist. Do you want to create it?",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:10,代码来源:postgres_dbs_tests.py

示例7: test_start

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
 def test_start(self):
     svc = svc_systemd.SvcSystemd(MagicMock(), "foo", {'running': True})
     status = MagicMock()
     status.info = {'running': False}
     self.assertEqual(
         svc.ask(status),
         "status not running → running\n",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:10,代码来源:svc_systemd_tests.py

示例8: test_drop

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
 def test_drop(self):
     role = postgres_roles.PostgresRole(MagicMock(), "bw", {'delete': True})
     status = MagicMock()
     status.info = {
         'exists': True,
         'needs_fixing': ['existence'],
     }
     self.assertEqual(
         role.ask(status),
         "Will be deleted.",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:13,代码来源:postgres_roles_tests.py

示例9: test_create

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
 def test_create(self):
     role = postgres_roles.PostgresRole(MagicMock(), "bw", {})
     status = MagicMock()
     status.info = {
         'exists': False,
         'needs_fixing': ['existence'],
     }
     self.assertEqual(
         role.ask(status),
         "Doesn't exist. Do you want to create it?",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:13,代码来源:postgres_roles_tests.py

示例10: create_mock_logger

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
def create_mock_logger():
    log_mock = MagicMock()
    log_mock.debug = MagicMock()
    log_mock.verbose = MagicMock()
    log_mock.info = MagicMock()
    log_mock.quiet = MagicMock()
    log_mock.warn = MagicMock()
    log_mock.error = MagicMock()

    get_logger_mock = MagicMock(return_value=log_mock)

    return get_logger_mock, log_mock
开发者ID:JustinPihony,项目名称:conductr-cli,代码行数:14,代码来源:cli_test_case.py

示例11: test_drop

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
 def test_drop(self):
     db = postgres_dbs.PostgresDB(MagicMock(), "foo", {'delete': True})
     status = MagicMock()
     status.info = {
         'exists': True,
         'needs_fixing': ['existence'],
         'owner': "bar",
     }
     self.assertEqual(
         db.ask(status),
         "Will be deleted.",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:14,代码来源:postgres_dbs_tests.py

示例12: test_change_owner

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
 def test_change_owner(self):
     db = postgres_dbs.PostgresDB(MagicMock(), "foo", {'owner': "bar"})
     status = MagicMock()
     status.info = {
         'exists': True,
         'needs_fixing': ['owner'],
         'owner': "foo",
     }
     self.assertEqual(
         db.ask(status),
         "owner  foo → bar",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:14,代码来源:postgres_dbs_tests.py

示例13: test_change_superuser

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
 def test_change_superuser(self):
     role = postgres_roles.PostgresRole(MagicMock(), "bw", {'superuser': False})
     status = MagicMock()
     status.info = {
         'exists': True,
         'needs_fixing': ['superuser'],
         'password_hash': "foo",
         'superuser': True,
     }
     self.assertEqual(
         role.ask(status),
         "superuser  True → False",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:15,代码来源:postgres_roles_tests.py

示例14: make_mock

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
    def make_mock(json_response):
        """Used in test_interesting.py."""
        response_mock = MagicMock()
        response_mock.read = Mock(return_value=json_response)
        if PY3:
            response_mock.status = 200
            response_mock.getheader = Mock(return_value='<https://api.github.com/repos/frost-nzcr4/find_forks/forks?page=2>; rel="next", '
                                           '<https://api.github.com/repos/frost-nzcr4/find_forks/forks?page=3>; rel="last"')
        else:
            response_mock.code = 200
            response_mock.info = Mock(return_value=(('link', '<https://api.github.com/repos/frost-nzcr4/find_forks/forks?page=2>; rel="next", '
                                                             '<https://api.github.com/repos/frost-nzcr4/find_forks/forks?page=3>; rel="last"'), ))

        return response_mock
开发者ID:BioQwer,项目名称:find_forks,代码行数:16,代码来源:test_find_forks.py

示例15: test_change_password

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import info [as 别名]
 def test_change_password(self):
     role = postgres_roles.PostgresRole(MagicMock(), "bw", {
         'superuser': False,
         'password': "new",
     })
     status = MagicMock()
     status.info = {
         'exists': True,
         'needs_fixing': ['superuser'],
         'password_hash': "old",
         'superuser': False,
     }
     self.assertEqual(
         role.ask(status),
         "password hash  old\n            →  md5d4011cb5bc2abb087f5ae9d3ca846423",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:18,代码来源:postgres_roles_tests.py


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