本文整理汇总了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)
示例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)
示例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)
示例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)