#NEWLINE# def test_create_and_list_ports( self ) : #NEWLINE# #INDENT# port_create_args = { #NEWLINE# #INDENT# 'allocation_pools' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# ports_per_network = 10 #NEWLINE# network_create_args = { #NEWLINE# #INDENT# 'router:external' : True , #NEWLINE# #UNINDENT# } #NEWLINE# net = mock . MagicMock ( ) #NEWLINE# scenario = network . NeutronNetworks ( self . context ) #NEWLINE# scenario . _get_or_create_network = mock . Mock ( return_value = net ) #NEWLINE# scenario . _create_port = mock . MagicMock ( ) #NEWLINE# scenario . _list_ports = mock . Mock ( ) #NEWLINE# scenario . create_and_list_ports ( network_create_args = network_create_args , port_create_args = port_create_args , ports_per_network = ports_per_network ) #NEWLINE# scenario . _get_or_create_network . assert_called_once_with ( network_create_args ) #NEWLINE# scenario . _create_port . assert_has_calls ( [ mock . call ( net , port_create_args ) for i in range ( self ) ] ) #NEWLINE# scenario . _list_ports . assert_called_once_with ( )