本文整理汇总了Python中boto.ec2.elb.ELBConnection.make_request方法的典型用法代码示例。如果您正苦于以下问题:Python ELBConnection.make_request方法的具体用法?Python ELBConnection.make_request怎么用?Python ELBConnection.make_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boto.ec2.elb.ELBConnection
的用法示例。
在下文中一共展示了ELBConnection.make_request方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_next_token
# 需要导入模块: from boto.ec2.elb import ELBConnection [as 别名]
# 或者: from boto.ec2.elb.ELBConnection import make_request [as 别名]
def test_next_token(self):
elb = ELBConnection(aws_access_key_id="aws_access_key_id", aws_secret_access_key="aws_secret_access_key")
mock_response = mock.Mock()
mock_response.read.return_value = DISABLE_RESPONSE
mock_response.status = 200
elb.make_request = mock.Mock(return_value=mock_response)
disabled = elb.disable_availability_zones("mine", ["sample-zone"])
self.assertEqual(disabled, ["sample-zone"])
示例2: test_detach_subnets
# 需要导入模块: from boto.ec2.elb import ELBConnection [as 别名]
# 或者: from boto.ec2.elb.ELBConnection import make_request [as 别名]
def test_detach_subnets(self):
elb = ELBConnection(aws_access_key_id="aws_access_key_id", aws_secret_access_key="aws_secret_access_key")
lb = LoadBalancer(elb, "mylb")
mock_response = mock.Mock()
mock_response.read.return_value = DETACH_RESPONSE
mock_response.status = 200
elb.make_request = mock.Mock(return_value=mock_response)
lb.detach_subnets("s-xxx")
示例3: _setup_mock
# 需要导入模块: from boto.ec2.elb import ELBConnection [as 别名]
# 或者: from boto.ec2.elb.ELBConnection import make_request [as 别名]
def _setup_mock(self):
"""Sets up a mock elb request.
Returns: response, elb connection and LoadBalancer
"""
mock_response = mock.Mock()
mock_response.status = 200
elb = ELBConnection(aws_access_key_id='aws_access_key_id',
aws_secret_access_key='aws_secret_access_key')
elb.make_request = mock.Mock(return_value=mock_response)
return mock_response, elb, LoadBalancer(elb, 'test_elb')
示例4: test_request_with_marker
# 需要导入模块: from boto.ec2.elb import ELBConnection [as 别名]
# 或者: from boto.ec2.elb.ELBConnection import make_request [as 别名]
def test_request_with_marker(self):
elb = ELBConnection(aws_access_key_id="aws_access_key_id", aws_secret_access_key="aws_secret_access_key")
mock_response = mock.Mock()
mock_response.read.return_value = DESCRIBE_RESPONSE
mock_response.status = 200
elb.make_request = mock.Mock(return_value=mock_response)
load_balancers1 = elb.get_all_load_balancers()
self.assertEqual("1234", load_balancers1.marker)
load_balancers2 = elb.get_all_load_balancers(marker=load_balancers1.marker)
self.assertEqual(len(load_balancers2), 1)
示例5: test_other_policy
# 需要导入模块: from boto.ec2.elb import ELBConnection [as 别名]
# 或者: from boto.ec2.elb.ELBConnection import make_request [as 别名]
def test_other_policy(self):
elb = ELBConnection(aws_access_key_id="aws_access_key_id", aws_secret_access_key="aws_secret_access_key")
mock_response = mock.Mock()
mock_response.read.return_value = DESCRIBE_RESPONSE
mock_response.status = 200
elb.make_request = mock.Mock(return_value=mock_response)
load_balancers = elb.get_all_load_balancers()
self.assertEqual(len(load_balancers), 1)
lb = load_balancers[0]
self.assertEqual(len(lb.policies.other_policies), 2)
self.assertEqual(
lb.policies.other_policies[0].policy_name, "AWSConsole-SSLNegotiationPolicy-my-test-loadbalancer"
)
self.assertEqual(lb.policies.other_policies[1].policy_name, "EnableProxyProtocol")
self.assertEqual(len(lb.backends), 1)
self.assertEqual(len(lb.backends[0].policies), 1)
self.assertEqual(lb.backends[0].policies[0].policy_name, "EnableProxyProtocol")
self.assertEqual(lb.backends[0].instance_port, 80)