Run black on moto & test directories.

This commit is contained in:
Asher Foa 2019-10-31 08:44:26 -07:00
commit 96e5b1993d
507 changed files with 52541 additions and 47814 deletions

View file

@ -4,89 +4,94 @@ from moto.ec2.utils import filters_from_querystring
class RouteTables(BaseResponse):
def associate_route_table(self):
route_table_id = self._get_param('RouteTableId')
subnet_id = self._get_param('SubnetId')
route_table_id = self._get_param("RouteTableId")
subnet_id = self._get_param("SubnetId")
association_id = self.ec2_backend.associate_route_table(
route_table_id, subnet_id)
route_table_id, subnet_id
)
template = self.response_template(ASSOCIATE_ROUTE_TABLE_RESPONSE)
return template.render(association_id=association_id)
def create_route(self):
route_table_id = self._get_param('RouteTableId')
destination_cidr_block = self._get_param('DestinationCidrBlock')
gateway_id = self._get_param('GatewayId')
instance_id = self._get_param('InstanceId')
interface_id = self._get_param('NetworkInterfaceId')
pcx_id = self._get_param('VpcPeeringConnectionId')
route_table_id = self._get_param("RouteTableId")
destination_cidr_block = self._get_param("DestinationCidrBlock")
gateway_id = self._get_param("GatewayId")
instance_id = self._get_param("InstanceId")
interface_id = self._get_param("NetworkInterfaceId")
pcx_id = self._get_param("VpcPeeringConnectionId")
self.ec2_backend.create_route(route_table_id, destination_cidr_block,
gateway_id=gateway_id,
instance_id=instance_id,
interface_id=interface_id,
vpc_peering_connection_id=pcx_id)
self.ec2_backend.create_route(
route_table_id,
destination_cidr_block,
gateway_id=gateway_id,
instance_id=instance_id,
interface_id=interface_id,
vpc_peering_connection_id=pcx_id,
)
template = self.response_template(CREATE_ROUTE_RESPONSE)
return template.render()
def create_route_table(self):
vpc_id = self._get_param('VpcId')
vpc_id = self._get_param("VpcId")
route_table = self.ec2_backend.create_route_table(vpc_id)
template = self.response_template(CREATE_ROUTE_TABLE_RESPONSE)
return template.render(route_table=route_table)
def delete_route(self):
route_table_id = self._get_param('RouteTableId')
destination_cidr_block = self._get_param('DestinationCidrBlock')
route_table_id = self._get_param("RouteTableId")
destination_cidr_block = self._get_param("DestinationCidrBlock")
self.ec2_backend.delete_route(route_table_id, destination_cidr_block)
template = self.response_template(DELETE_ROUTE_RESPONSE)
return template.render()
def delete_route_table(self):
route_table_id = self._get_param('RouteTableId')
route_table_id = self._get_param("RouteTableId")
self.ec2_backend.delete_route_table(route_table_id)
template = self.response_template(DELETE_ROUTE_TABLE_RESPONSE)
return template.render()
def describe_route_tables(self):
route_table_ids = self._get_multi_param('RouteTableId')
route_table_ids = self._get_multi_param("RouteTableId")
filters = filters_from_querystring(self.querystring)
route_tables = self.ec2_backend.get_all_route_tables(
route_table_ids, filters)
route_tables = self.ec2_backend.get_all_route_tables(route_table_ids, filters)
template = self.response_template(DESCRIBE_ROUTE_TABLES_RESPONSE)
return template.render(route_tables=route_tables)
def disassociate_route_table(self):
association_id = self._get_param('AssociationId')
association_id = self._get_param("AssociationId")
self.ec2_backend.disassociate_route_table(association_id)
template = self.response_template(DISASSOCIATE_ROUTE_TABLE_RESPONSE)
return template.render()
def replace_route(self):
route_table_id = self._get_param('RouteTableId')
destination_cidr_block = self._get_param('DestinationCidrBlock')
gateway_id = self._get_param('GatewayId')
instance_id = self._get_param('InstanceId')
interface_id = self._get_param('NetworkInterfaceId')
pcx_id = self._get_param('VpcPeeringConnectionId')
route_table_id = self._get_param("RouteTableId")
destination_cidr_block = self._get_param("DestinationCidrBlock")
gateway_id = self._get_param("GatewayId")
instance_id = self._get_param("InstanceId")
interface_id = self._get_param("NetworkInterfaceId")
pcx_id = self._get_param("VpcPeeringConnectionId")
self.ec2_backend.replace_route(route_table_id, destination_cidr_block,
gateway_id=gateway_id,
instance_id=instance_id,
interface_id=interface_id,
vpc_peering_connection_id=pcx_id)
self.ec2_backend.replace_route(
route_table_id,
destination_cidr_block,
gateway_id=gateway_id,
instance_id=instance_id,
interface_id=interface_id,
vpc_peering_connection_id=pcx_id,
)
template = self.response_template(REPLACE_ROUTE_RESPONSE)
return template.render()
def replace_route_table_association(self):
route_table_id = self._get_param('RouteTableId')
association_id = self._get_param('AssociationId')
route_table_id = self._get_param("RouteTableId")
association_id = self._get_param("AssociationId")
new_association_id = self.ec2_backend.replace_route_table_association(
association_id, route_table_id)
template = self.response_template(
REPLACE_ROUTE_TABLE_ASSOCIATION_RESPONSE)
association_id, route_table_id
)
template = self.response_template(REPLACE_ROUTE_TABLE_ASSOCIATION_RESPONSE)
return template.render(association_id=new_association_id)