#NEWLINE# def test__add_default_gw_virtual_route( self ) : #NEWLINE# #INDENT# ri = self . _create_router ( ) #NEWLINE# mock_instance = mock . Mock ( ) #NEWLINE# mock_instance . virtual_routes . gateway_routes = [ ] #NEWLINE# ri . _get_keepalived_instance = mock . Mock ( return_value = mock_instance ) #NEWLINE# subnets = [ { #NEWLINE# #INDENT# 'id' : _uuid ( ) , #NEWLINE# 'cidr' : '20.0.0.0/24' , #NEWLINE# 'gateway_ip' : None , #NEWLINE# #UNINDENT# } ] #NEWLINE# ex_gw_port = { #NEWLINE# #INDENT# 'fixed_ips' : [ ] , #NEWLINE# 'subnets' : subnets , #NEWLINE# 'extra_subnets' : [ ] , #NEWLINE# 'id' : _uuid ( ) , #NEWLINE# 'network_id' : _uuid ( ) , #NEWLINE# 'mac_address' : 'ca:fe:de:ad:be:ef' , #NEWLINE# #UNINDENT# } #NEWLINE# ri . _add_default_gw_virtual_route ( mock_instance , 'qg-abc' ) #NEWLINE# self . assertEqual ( 0 , len ( mock_instance . virtual_routes . gateway_routes ) ) #NEWLINE# subnets . append ( { #NEWLINE# #INDENT# 'id' : _uuid ( ) , #NEWLINE# 'cidr' : '30.0.0.0/24' , #NEWLINE# 'gateway_ip' : '30.0.0.1' , #NEWLINE# #UNINDENT# } ) #NEWLINE# ri . _add_default_gw_virtual_route ( ex_gw_port , 'qg-abc' ) #NEWLINE# self . assertEqual ( 1 , len ( mock_instance . virtual_routes . gateway_routes ) )