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


Python MagicMock.params方法代码示例

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


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

示例1: test_batch_osd_container

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import params [as 别名]
    def test_batch_osd_container(self):
        fake_module = MagicMock()
        fake_module.params = {'data': '/dev/sda',
                              'objectstore': 'filestore',
                              'journal_size': '100',
                              'cluster': 'ceph',
                              'batch_devices': ["/dev/sda", "/dev/sdb"]}

        fake_container_image = "docker.io/ceph/daemon:latest-luminous"
        expected_command_list = ['docker', 'run', '--rm', '--privileged', '--net=host', '--ipc=host',  # noqa E501
                                 '-v', '/run/lock/lvm:/run/lock/lvm:z',
                                 '-v', '/var/run/udev/:/var/run/udev/:z',
                                 '-v', '/dev:/dev', '-v', '/etc/ceph:/etc/ceph:z',  # noqa E501
                                 '-v', '/run/lvm/:/run/lvm/',  # noqa E501
                                 '-v', '/var/lib/ceph/:/var/lib/ceph/:z',
                                 '-v', '/var/log/ceph/:/var/log/ceph/:z',
                                 '--entrypoint=ceph-volume',
                                 'docker.io/ceph/daemon:latest-luminous',
                                 '--cluster',
                                 'ceph',
                                 'lvm',
                                 'batch',
                                 '--filestore',
                                 '--yes',
                                 '--prepare',
                                 '--journal-size',
                                 '100',
                                 '/dev/sda',
                                 '/dev/sdb']
        result = ceph_volume.batch(
            fake_module, fake_container_image)
        assert result == expected_command_list
开发者ID:ceph,项目名称:ceph-ansible,代码行数:34,代码来源:test_ceph_volume.py

示例2: test_prepare_osd_container

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import params [as 别名]
    def test_prepare_osd_container(self):
        fake_module = MagicMock()
        fake_module.params = {'data': '/dev/sda',
                              'objectstore': 'filestore',
                              'cluster': 'ceph', }

        fake_action = "prepare"
        fake_container_image = "docker.io/ceph/daemon:latest-luminous"
        expected_command_list = ['docker', 'run', '--rm', '--privileged', '--net=host', '--ipc=host',  # noqa E501
                                 '-v', '/run/lock/lvm:/run/lock/lvm:z',
                                 '-v', '/var/run/udev/:/var/run/udev/:z',
                                 '-v', '/dev:/dev', '-v', '/etc/ceph:/etc/ceph:z',  # noqa E501
                                 '-v', '/run/lvm/:/run/lvm/',  # noqa E501
                                 '-v', '/var/lib/ceph/:/var/lib/ceph/:z',
                                 '-v', '/var/log/ceph/:/var/log/ceph/:z',
                                 '--entrypoint=ceph-volume',
                                 'docker.io/ceph/daemon:latest-luminous',
                                 '--cluster',
                                 'ceph',
                                 'lvm',
                                 'prepare',
                                 '--filestore',
                                 '--data',
                                 '/dev/sda']
        result = ceph_volume.prepare_or_create_osd(
            fake_module, fake_action, fake_container_image)
        assert result == expected_command_list
开发者ID:ceph,项目名称:ceph-ansible,代码行数:29,代码来源:test_ceph_volume.py

示例3: test_zap_osd

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import params [as 别名]
 def test_zap_osd(self):
     fake_module = MagicMock()
     fake_module.params = {'data': '/dev/sda'}
     fake_container_image = None
     expected_command_list = ['ceph-volume',
                              'lvm',
                              'zap',
                              '--destroy',
                              '/dev/sda']
     result = ceph_volume.zap_devices(fake_module, fake_container_image)
     assert result == expected_command_list
开发者ID:ceph,项目名称:ceph-ansible,代码行数:13,代码来源:test_ceph_volume.py

示例4: test_list_osd

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import params [as 别名]
 def test_list_osd(self):
     fake_module = MagicMock()
     fake_module.params = {'cluster': 'ceph', 'data': '/dev/sda'}
     fake_container_image = None
     expected_command_list = ['ceph-volume',
                              '--cluster',
                              'ceph',
                              'lvm',
                              'list',
                              '/dev/sda',
                              '--format=json',
                              ]
     result = ceph_volume.list_osd(fake_module, fake_container_image)
     assert result == expected_command_list
开发者ID:ceph,项目名称:ceph-ansible,代码行数:16,代码来源:test_ceph_volume.py

示例5: test_zap_osd_container

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import params [as 别名]
 def test_zap_osd_container(self):
     fake_module = MagicMock()
     fake_module.params = {'data': '/dev/sda'}
     fake_container_image = "docker.io/ceph/daemon:latest-luminous"
     expected_command_list = ['docker', 'run', '--rm', '--privileged', '--net=host', '--ipc=host',  # noqa E501
                              '-v', '/run/lock/lvm:/run/lock/lvm:z',
                              '-v', '/var/run/udev/:/var/run/udev/:z',
                              '-v', '/dev:/dev', '-v', '/etc/ceph:/etc/ceph:z',  # noqa E501
                              '-v', '/run/lvm/:/run/lvm/',  # noqa E501
                              '-v', '/var/lib/ceph/:/var/lib/ceph/:z',
                              '-v', '/var/log/ceph/:/var/log/ceph/:z',
                              '--entrypoint=ceph-volume',
                              'docker.io/ceph/daemon:latest-luminous',
                              'lvm',
                              'zap',
                              '--destroy',
                              '/dev/sda']
     result = ceph_volume.zap_devices(fake_module, fake_container_image)
     assert result == expected_command_list
开发者ID:ceph,项目名称:ceph-ansible,代码行数:21,代码来源:test_ceph_volume.py

示例6: test_prepare_osd

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import params [as 别名]
    def test_prepare_osd(self):
        fake_module = MagicMock()
        fake_module.params = {'data': '/dev/sda',
                              'objectstore': 'filestore',
                              'cluster': 'ceph', }

        fake_container_image = None
        fake_action = "prepare"
        expected_command_list = ['ceph-volume',
                                 '--cluster',
                                 'ceph',
                                 'lvm',
                                 'prepare',
                                 '--filestore',
                                 '--data',
                                 '/dev/sda']
        result = ceph_volume.prepare_or_create_osd(
            fake_module, fake_action, fake_container_image)
        assert result == expected_command_list
开发者ID:ceph,项目名称:ceph-ansible,代码行数:21,代码来源:test_ceph_volume.py

示例7: test_batch_osd

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import params [as 别名]
    def test_batch_osd(self):
        fake_module = MagicMock()
        fake_module.params = {'data': '/dev/sda',
                              'objectstore': 'filestore',
                              'journal_size': '100',
                              'cluster': 'ceph',
                              'batch_devices': ["/dev/sda", "/dev/sdb"]}

        fake_container_image = None
        expected_command_list = ['ceph-volume',
                                 '--cluster',
                                 'ceph',
                                 'lvm',
                                 'batch',
                                 '--filestore',
                                 '--yes',
                                 '--journal-size',
                                 '100',
                                 '/dev/sda',
                                 '/dev/sdb']
        result = ceph_volume.batch(
            fake_module, fake_container_image)
        assert result == expected_command_list
开发者ID:ceph,项目名称:ceph-ansible,代码行数:25,代码来源:test_ceph_volume.py


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