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


Python LocalState.should_receive方法代码示例

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


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

示例1: test_start_all_nodes_reattach_changed_asf

# 需要导入模块: from appscale.tools.local_state import LocalState [as 别名]
# 或者: from appscale.tools.local_state.LocalState import should_receive [as 别名]
  def test_start_all_nodes_reattach_changed_asf(self):
    self.options = flexmock(
      infrastructure='public cloud',
      group='group',
      machine='vm image',
      instance_type='instance type',
      keyname='keyname',
      table='cassandra',
      verbose=False,
      test=False,
      use_spot_instances=False,
      zone='zone',
      static_ip=None,
      replication=None,
      appengine=None,
      autoscale=None,
      user_commands=[],
      flower_password='',
      max_memory='X',
      ips=THREE_NODE_CLOUD
    )

    self.node_layout = NodeLayout(self.options)

    fake_agent = FakeAgent()
    flexmock(factory.InfrastructureAgentFactory). \
      should_receive('create_agent'). \
      with_args('public cloud'). \
      and_return(fake_agent)

    LocalState.should_receive('get_local_nodes_info')\
      .and_return(self.reattach_node_info)

    self.assertRaises(BadConfigurationException)
开发者ID:AppScale,项目名称:appscale-tools,代码行数:36,代码来源:test_remote_helper.py

示例2: test_start_all_nodes_reattach_changed_locations

# 需要导入模块: from appscale.tools.local_state import LocalState [as 别名]
# 或者: from appscale.tools.local_state.LocalState import should_receive [as 别名]
  def test_start_all_nodes_reattach_changed_locations(self):
    self.node_layout = NodeLayout(self.reattach_options)

    fake_agent = FakeAgent()
    flexmock(factory.InfrastructureAgentFactory). \
      should_receive('create_agent'). \
      with_args('public cloud'). \
      and_return(fake_agent)

    LocalState.should_receive('get_host_with_role').and_return('0.0.0.1')

    node_info = [{ "public_ip": "0.0.0.0",
                   "private_ip": "0.0.0.0",
                   "instance_id": "i-APPSCALE1",
                   "roles": ['load_balancer', 'taskqueue', 'shadow',
                            'taskqueue_master'] },
                 { "public_ip": "0.0.0.0",
                   "private_ip": "0.0.0.0",
                   "instance_id": "i-APPSCALE2",
                   "roles": ['memcache', 'appengine'] },
                 { "public_ip": "0.0.0.0",
                   "private_ip": "0.0.0.0",
                   "instance_id": "i-APPSCALE3",
                   "roles": ['zookeeper', "appengine"] },
                 { "public_ip": "0.0.0.0",
                   "private_ip": "0.0.0.0",
                   "instance_id": "i-APPSCALE4",
                   "roles": ['db_master'] }
                 ]

    LocalState.should_receive('get_local_nodes_info').and_return(node_info)

    self.assertRaises(BadConfigurationException)
开发者ID:AppScale,项目名称:appscale-tools,代码行数:35,代码来源:test_remote_helper.py

示例3: test_start_all_nodes_reattach

# 需要导入模块: from appscale.tools.local_state import LocalState [as 别名]
# 或者: from appscale.tools.local_state.LocalState import should_receive [as 别名]
  def test_start_all_nodes_reattach(self):
    self.node_layout = NodeLayout(self.reattach_options)
    self.assertNotEqual([], self.node_layout.nodes)
    fake_agent = FakeAgent()
    flexmock(factory.InfrastructureAgentFactory). \
      should_receive('create_agent'). \
      with_args('euca'). \
      and_return(fake_agent)

    LocalState.should_receive('get_host_with_role').and_return(IP_1)

    LocalState.should_receive('get_local_nodes_info') \
      .and_return(self.reattach_node_info)

    RemoteHelper.start_all_nodes(self.reattach_options,
                                 self.node_layout)
开发者ID:AppScale,项目名称:appscale-tools,代码行数:18,代码来源:test_remote_helper.py

示例4: test_extract_tgz_app_to_dir

# 需要导入模块: from appscale.tools.local_state import LocalState [as 别名]
# 或者: from appscale.tools.local_state.LocalState import should_receive [as 别名]
  def test_extract_tgz_app_to_dir(self):
    flexmock(os)
    os.should_receive('mkdir').and_return()
    flexmock(os.path)
    os.path.should_receive('abspath').with_args('relative/app.tar.gz') \
      .and_return('/tmp/relative/app.tar.gz')

    flexmock(LocalState)
    LocalState.should_receive('shell') \
      .with_args(re.compile("tar zxvf '/tmp/relative/app.tar.gz'"), False) \
      .and_return()

    os.should_receive('listdir').and_return(['one_folder'])
    os.path.should_receive('isdir').with_args(re.compile('one_folder')) \
      .and_return(True)

    location = LocalState.extract_tgz_app_to_dir('relative/app.tar.gz', False)
    self.assertEquals(True, 'one_folder' in location)
开发者ID:menivaitsi,项目名称:appscale-tools,代码行数:20,代码来源:test_local_state.py


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