#NEWLINE# def test_attach_igw( self ) : #NEWLINE# #INDENT# self . configure ( external_network = fakes . NAME_OS_PUBLIC_NETWORK ) #NEWLINE# self . set_mock_db_items ( fakes . DB_IGW_1 , fakes . DB_IGW_2 , fakes . DB_VPC_2 , fakes . DB_VPN_GATEWAY_1 , fakes . DB_VPN_GATEWAY_2 ) #NEWLINE# self . neutron . list_networks . return_value = { #NEWLINE# #INDENT# 'networks' : [ { #NEWLINE# #INDENT# 'id' : fakes . ID_OS_PUBLIC_NETWORK , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# def do_check( ) : #NEWLINE# #INDENT# resp = self . execute ( 'AttachInternetGateway' , { #NEWLINE# #INDENT# 'VpcId' : fakes . ID_EC2_VPC_2 , #NEWLINE# 'InternetGatewayId' : fakes . ID_EC2_IGW_2 , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( True , resp [ 'return' ] ) #NEWLINE# self . db_api . update_item . assert_called_once_with ( mock . ANY , self . DB_IGW_2_ATTACHED ) #NEWLINE# #UNINDENT# do_check ( ) #NEWLINE# self . neutron . add_gateway_router . assert_called_once_with ( fakes . ID_OS_ROUTER_2 , { #NEWLINE# #INDENT# 'network_id' : fakes . ID_OS_PUBLIC_NETWORK , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . neutron . list_networks . assert_called_once_with ( ** { #NEWLINE# #INDENT# 'router:external' : True , #NEWLINE# 'name' : fakes . NAME_OS_PUBLIC_NETWORK , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . db_api . reset_mock ( ) #NEWLINE# self . neutron . reset_mock ( ) #NEWLINE# vgw_2 = tools . update_dict ( fakes . DB_VPN_GATEWAY_2 , { #NEWLINE# #INDENT# 'vpc_id' : fakes . ID_EC2_VPC_2 , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . add_mock_db_items ( vgw_2 ) #NEWLINE# do_check ( ) #NEWLINE# self . assertFalse ( self . neutron . add_gateway_router . called )