本文整理汇总了Python中boto.vpc.VPCConnection.detach_internet_gateway方法的典型用法代码示例。如果您正苦于以下问题:Python VPCConnection.detach_internet_gateway方法的具体用法?Python VPCConnection.detach_internet_gateway怎么用?Python VPCConnection.detach_internet_gateway使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boto.vpc.VPCConnection
的用法示例。
在下文中一共展示了VPCConnection.detach_internet_gateway方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestVPCConnection
# 需要导入模块: from boto.vpc import VPCConnection [as 别名]
# 或者: from boto.vpc.VPCConnection import detach_internet_gateway [as 别名]
class TestVPCConnection(unittest.TestCase):
"""
Test class for `boto.vpc.VPCConnection`
"""
def setUp(self):
"""
Setup method to initialize vpc_connection objectq
"""
super(TestVPCConnection, self).setUp()
self.vpc_connection = VPCConnection(
aws_access_key_id='aws_access_key_id',
aws_secret_access_key='aws_secret_access_key')
def test_detach_internet_gateway(self):
"""
Tests detach_internet_gateway with all valid parameters
"""
internet_gateway_id = 'mock_gateway_id'
vpc_id = 'mock_vpc_id'
def get_status(status, params):
if status == "DetachInternetGateway" and \
params["InternetGatewayId"] == internet_gateway_id and \
params["VpcId"] == vpc_id:
return True
else:
return False
self.vpc_connection.get_status = get_status
status = self.vpc_connection.detach_internet_gateway(
internet_gateway_id, vpc_id)
self.assertEquals(True, status)
示例2: TestVPCConnection
# 需要导入模块: from boto.vpc import VPCConnection [as 别名]
# 或者: from boto.vpc.VPCConnection import detach_internet_gateway [as 别名]
class TestVPCConnection(unittest.TestCase):
"""
Test class for `boto.vpc.VPCConnection`
"""
def setUp(self):
"""
Setup method to initialize vpc_connection objectq
"""
super(TestVPCConnection, self).setUp()
self.vpc_connection = VPCConnection(
aws_access_key_id="aws_access_key_id", aws_secret_access_key="aws_secret_access_key"
)
def test_detach_internet_gateway(self):
"""
Tests detach_internet_gateway with all valid parameters
"""
internet_gateway_id = "mock_gateway_id"
vpc_id = "mock_vpc_id"
def get_status(status, params):
if (
status == "DetachInternetGateway"
and params["InternetGatewayId"] == internet_gateway_id
and params["VpcId"] == vpc_id
):
return True
else:
return False
self.vpc_connection.get_status = get_status
status = self.vpc_connection.detach_internet_gateway(internet_gateway_id, vpc_id)
self.assertEquals(True, status)
def test_replace_route_table_association(self):
"""
Tests replace_route_table_assocation with all valid parameters
"""
association_id = "mock_association_id"
route_table_id = "mock_route_table_id"
def get_status(status, params):
if (
status == "ReplaceRouteTableAssociation"
and params["AssociationId"] == association_id
and params["RouteTableId"] == route_table_id
):
return True
else:
return False
self.vpc_connection.get_status = get_status
status = self.vpc_connection.replace_route_table_assocation(association_id, route_table_id)
self.assertEquals(True, status)