#NEWLINE# def test_server_create_with_network( self ) : #NEWLINE# #INDENT# arglist = [ '--image' , 'image1' , '--flavor' , 'flavor1' , '--nic' , 'net-id=net1' , '--nic' , 'port-id=port1' , self . new_server . name ] #NEWLINE# verifylist = [ ( 'image' , 'image1' ) , ( 'flavor' , 'flavor1' ) , ( 'nic' , [ 'net-id=net1' , 'port-id=port1' ] ) , ( 'config_drive' , False ) , ( 'server_name' , self . new_server . name ) ] #NEWLINE# parsed_args = self . check_parser ( self . cmd , arglist , verifylist ) #NEWLINE# get_endpoints = mock . Mock ( ) #NEWLINE# get_endpoints . return_value = { #NEWLINE# #INDENT# 'network' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# self . app . client_manager . auth_ref = mock . Mock ( ) #NEWLINE# self . app . client_manager . auth_ref . service_catalog = mock . Mock ( ) #NEWLINE# self . app . client_manager . auth_ref . service_catalog . get_endpoints = get_endpoints #NEWLINE# find_network = mock . Mock ( ) #NEWLINE# find_port = mock . Mock ( ) #NEWLINE# network_client = self . app . client_manager . network #NEWLINE# network_client . find_network = find_network #NEWLINE# network_client . find_port = find_port #NEWLINE# network_resource = mock . Mock ( ) #NEWLINE# network_resource . id = 'net1_uuid' #NEWLINE# port_resource = mock . Mock ( ) #NEWLINE# port_resource . id = 'port1_uuid' #NEWLINE# find_network . return_value = network_resource #NEWLINE# find_port . return_value = port_resource #NEWLINE# _network = mock . Mock ( ) #NEWLINE# _network . id = 'net1_uuid' #NEWLINE# _port = mock . Mock ( ) #NEWLINE# _port . id = 'port1_uuid' #NEWLINE# find_network = mock . Mock ( ) #NEWLINE# find_port = mock . Mock ( ) #NEWLINE# find_network . return_value = _network #NEWLINE# find_port . return_value = _port #NEWLINE# self . app . client_manager . network . find_network = find_network #NEWLINE# self . app . client_manager . network . find_port = find_port #NEWLINE# ( columns , data ) = self . cmd . take_action ( parsed_args ) #NEWLINE# kwargs = dict ( meta = None , files = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , reservation_id = None , min_count = 1 , max_count = 1 , security_groups = [ ] , userdata = None , key_name = None , availability_zone = None , block_device_mapping = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , nics = [ { #NEWLINE# #INDENT# 'net-id' : 'net1_uuid' , #NEWLINE# 'v4-fixed-ip' : '' , #NEWLINE# 'v6-fixed-ip' : '' , #NEWLINE# 'port-id' : '' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'net-id' : '' , #NEWLINE# 'v4-fixed-ip' : '' , #NEWLINE# 'v6-fixed-ip' : '' , #NEWLINE# 'port-id' : 'port1_uuid' , #NEWLINE# #UNINDENT# } ] , scheduler_hints = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , config_drive = None ) #NEWLINE# self . servers_mock . create . assert_called_with ( self . new_server . name , self . image , self . flavor , ** _network ) #NEWLINE# self . assertEqual ( self . columns , columns ) #NEWLINE# self . assertEqual ( self . datalist ( ) , data )