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


Python Mock.cluster方法代码示例

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


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

示例1: make_mock_options

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
 def make_mock_options(self):
   mock_options = Mock()
   mock_options.filename = None
   mock_options.hosts = ','.join(self.HOSTNAMES)
   mock_options.cluster = self.TEST_CLUSTER
   mock_options.verbosity = False
   return mock_options
开发者ID:MustafaOrkunAcar,项目名称:incubator-aurora,代码行数:9,代码来源:test_maintenance.py

示例2: test_deploy_image_error

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
    def test_deploy_image_error(self):

        PROCESS.communicate = Mock(return_value=['error'])
        ovf = OvfImageDeployerService('dummypath/ovftool.exe')
        image_params = Mock()
        image_params.connectivity = VCenterConnectionDetails('venter.host.com', 'vcenter user', 'password to vcenter')
        image_params.datacenter = 'QualiSB'
        image_params.cluster = 'QualiSB Cluster'
        image_params.resource_pool = 'LiverPool'
        image_params.vm_name = 'raz_deploy_image_integration_test'
        image_params.datastore = 'aa'
        # image_params.image_url = "C:\\images\\test\\OVAfile121_QS\\OVAfile121_QS.ovf"
        image_params.image_url = "http://192.168.65.88/ovf/Debian 64 - Yoav.ovf"

        image_params.user_arguments = '--vlan="anetwork"'

        ovf._validate_url_exists = Mock(return_value=True)

        vcenter_data_model = Mock()
        vcenter_data_model.ovf_tool_path = 'dummypath/ovftool.exe'

        try:
            ovf.deploy_image(vcenter_data_model, image_params, logger=Mock())
            # should not reach here
            self.assertTrue(False)
        except Exception as inst:
            self.assertTrue(inst.message.find('password to vcenter') == -1)
            self.assertTrue(inst.message.find(urllib.quote_plus('******')) > -1)
            self.assertTrue(PROCESS.stdin.close.called)
开发者ID:AharonShachar,项目名称:vCenterShell,代码行数:31,代码来源:test_ovf_image_tool.py

示例3: setup_mock_options

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
 def setup_mock_options(cls):
   """set up to get a mock options object."""
   mock_options = Mock()
   mock_options.open_browser = False
   mock_options.shards = None
   mock_options.cluster = None
   mock_options.json = False
   return mock_options
开发者ID:betepahos,项目名称:incubator-aurora,代码行数:10,代码来源:test_kill.py

示例4: test_create_mon_path_if_nonexistent

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
    def test_create_mon_path_if_nonexistent(self):
        self.distro.sudo_conn.modules.os.path.exists = Mock(side_effect=path_exists(["/"]))
        args = Mock(return_value=["cluster", "1234", "initd"])
        args.cluster = "cluster"
        with patch("ceph_deploy.hosts.common.conf.load"):
            mon_create(self.distro, self.logger, args, Mock(), "hostname")

        result = self.distro.sudo_conn.modules.os.makedirs.call_args_list[0]
        assert result == call("/var/lib/ceph/mon/cluster-hostname")
开发者ID:rmoe,项目名称:ceph-deploy,代码行数:11,代码来源:test_mon.py

示例5: setup_mock_options

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
 def setup_mock_options(cls):
   """set up to get a mock options object."""
   mock_options = Mock()
   mock_options.json = False
   mock_options.bindings = {}
   mock_options.open_browser = False
   mock_options.cluster = None
   mock_options.wait_until = 'RUNNING'  # or 'FINISHED' for other tests
   return mock_options
开发者ID:mgargenta,项目名称:incubator-aurora,代码行数:11,代码来源:test_create.py

示例6: test_upgrade_common

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
    def test_upgrade_common(self,
                            m_get_upgrade_version,
                            m_verify_package_version,
                            m_get_system_type,
                            m_get_package_version):
        expected_system_type = 'deb'
        def make_remote():
            remote = Mock()
            remote.arch = 'x86_64'
            remote.os = Mock()
            remote.os.name = 'ubuntu'
            remote.os.version = '14.04'
            remote.os.codename = 'trusty'
            remote.system_type = expected_system_type
            return remote
        ctx = Mock()
        class cluster:
            remote1 = make_remote()
            remote2 = make_remote()
            remotes = {
                remote1: ['client.0'],
                remote2: ['mon.a','osd.0'],
            }
            def only(self, role):
                result = Mock()
                if role in ('client.0',):
                    result.remotes = { cluster.remote1: None }
                if role in ('osd.0', 'mon.a'):
                    result.remotes = { cluster.remote2: None }
                return result
        ctx.cluster = cluster()
        config = {
            'client.0': {
                'sha1': 'expectedsha1',
            },
        }
        ctx.config = {
            'roles': [ ['client.0'], ['mon.a','osd.0'] ],
            'tasks': [
                {
                    'install.upgrade': config,
                },
            ],
        }
	m_get_upgrade_version.return_value = "11.0.0"
        m_get_package_version.return_value = "10.2.4"
        m_get_system_type.return_value = "deb"
        def upgrade(ctx, node, remote, pkgs, system_type):
            assert system_type == expected_system_type
        assert install.upgrade_common(ctx, config, upgrade) == 1
        expected_config = {
            'project': 'ceph',
            'sha1': 'expectedsha1',
        }
        m_verify_package_version.assert_called_with(ctx,
                                                    expected_config,
                                                    cluster.remote1)
开发者ID:Vicente-Cheng,项目名称:teuthology,代码行数:59,代码来源:test_install.py

示例7: setup_mock_options

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
 def setup_mock_options(cls):
     """set up to get a mock options object."""
     mock_options = Mock()
     mock_options.env = None
     mock_options.json = False
     mock_options.bindings = {}
     mock_options.open_browser = False
     mock_options.rename_from = None
     mock_options.cluster = None
     return mock_options
开发者ID:kpeterson1,项目名称:aurora,代码行数:12,代码来源:test_diff.py

示例8: test_create_mon_path_if_nonexistent

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
    def test_create_mon_path_if_nonexistent(self):
        self.distro.sudo_conn.modules.os.path.exists = Mock(
            side_effect=path_exists(['/']))
        args = Mock(return_value=['cluster', '1234', 'initd'])
        args.cluster = 'cluster'
        with patch('ceph_deploy.hosts.common.conf.load'):
            mon_create(self.distro, self.logger, args, Mock(), 'hostname')

        result = self.distro.sudo_conn.modules.os.makedirs.call_args_list[0]
        assert result == call('/var/lib/ceph/mon/cluster-hostname')
开发者ID:BenoitKnecht,项目名称:ceph-deploy,代码行数:12,代码来源:test_mon.py

示例9: test_create_mon_tmp_path_if_nonexistent

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
    def test_create_mon_tmp_path_if_nonexistent(self):
        self.distro.sudo_conn.modules.os.path.exists = Mock(
            side_effect=path_exists(['/cluster-hostname']))
        self.paths.mon.constants.tmp_path = '/var/lib/ceph/tmp'
        args = Mock(return_value=['cluster', '1234', 'initd'])
        args.cluster = 'cluster'
        with patch('ceph_deploy.hosts.common.conf.load'):
            mon_create(self.distro, args, Mock(), 'hostname')

        result = self.distro.conn.remote_module.create_mon_path.call_args_list[-1]
        assert result ==mock.call('/var/lib/ceph/mon/cluster-hostname')
开发者ID:SUSE,项目名称:ceph-deploy,代码行数:13,代码来源:test_mon.py

示例10: setup_mock_options

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
 def setup_mock_options(cls):
   """set up to get a mock options object."""
   mock_options = Mock()
   mock_options.open_browser = False
   mock_options.shards = None
   mock_options.cluster = None
   mock_options.json = False
   mock_options.batch_size = None
   mock_options.max_total_failures = 1
   mock_options.disable_all_hooks = False
   return mock_options
开发者ID:dhardy92,项目名称:incubator-aurora,代码行数:13,代码来源:test_kill.py

示例11: test_write_keyring

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
    def test_write_keyring(self):
        self.distro.sudo_conn.modules.os.path.exists = Mock(side_effect=path_exists(["/"]))
        args = Mock(return_value=["cluster", "1234", "initd"])
        args.cluster = "cluster"
        with patch("ceph_deploy.hosts.common.conf.load"):
            with patch("ceph_deploy.hosts.common.remote") as fake_remote:
                mon_create(self.distro, self.logger, args, Mock(), "hostname")

        # the second argument to `remote()` should be the write func
        result = fake_remote.call_args_list[1][0][-1].__name__
        assert result == "write_monitor_keyring"
开发者ID:rmoe,项目名称:ceph-deploy,代码行数:13,代码来源:test_mon.py

示例12: test_write_init_path

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
    def test_write_init_path(self):
        self.distro.sudo_conn.modules.os.path.exists = Mock(side_effect=path_exists(["/"]))
        args = Mock(return_value=["cluster", "1234", "initd"])
        args.cluster = "cluster"

        with patch("ceph_deploy.hosts.common.conf.load"):
            with patch("ceph_deploy.hosts.common.remote") as fake_remote:
                mon_create(self.distro, self.logger, args, Mock(), "hostname")

        result = fake_remote.call_args_list[-1][0][-1].__name__
        assert result == "create_init_path"
开发者ID:rmoe,项目名称:ceph-deploy,代码行数:13,代码来源:test_mon.py

示例13: make_mock_options

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
 def make_mock_options(self):
   mock_options = Mock()
   mock_options.filename = None
   mock_options.hosts = ','.join(self.HOSTNAMES)
   mock_options.cluster = self.TEST_CLUSTER
   mock_options.verbosity = False
   mock_options.disable_all_hooks = False
   mock_options.percentage = None
   mock_options.duration = None
   mock_options.reason = None
   return mock_options
开发者ID:bhuvan,项目名称:incubator-aurora,代码行数:13,代码来源:test_maintenance.py

示例14: test_write_init_path

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
    def test_write_init_path(self):
        self.distro.sudo_conn.modules.os.path.exists = Mock(
            side_effect=path_exists(['/']))
        args = Mock(return_value=['cluster', '1234', 'initd'])
        args.cluster = 'cluster'

        with patch('ceph_deploy.hosts.common.conf.load'):
            with patch('ceph_deploy.hosts.common.remote') as fake_remote:
                mon_create(self.distro, self.logger, args, Mock(), 'hostname')

        result = fake_remote.call_args_list[-1][0][-1].__name__
        assert result == 'create_init_path'
开发者ID:davidvossel,项目名称:ceph-deploy,代码行数:14,代码来源:test_mon.py

示例15: test_write_keyring

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import cluster [as 别名]
    def test_write_keyring(self):
        self.distro.sudo_conn.modules.os.path.exists = Mock(
            side_effect=path_exists(['/']))
        args = Mock(return_value=['cluster', '1234', 'initd'])
        args.cluster = 'cluster'
        with patch('ceph_deploy.hosts.common.conf.load'):
            with patch('ceph_deploy.hosts.common.remote') as fake_remote:
                mon_create(self.distro, self.logger, args, Mock(), 'hostname')

        # the second argument to `remote()` should be the write func
        result = fake_remote.call_args_list[1][0][-1].__name__
        assert result == 'write_monitor_keyring'
开发者ID:davidvossel,项目名称:ceph-deploy,代码行数:14,代码来源:test_mon.py


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