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


Python VPCConnection.replace_route_table_assocation方法代码示例

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


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

示例1: TestVPCConnection

# 需要导入模块: from boto.vpc import VPCConnection [as 别名]
# 或者: from boto.vpc.VPCConnection import replace_route_table_assocation [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)
开发者ID:nuwar,项目名称:boto,代码行数:57,代码来源:test_vpc.py


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