#NEWLINE# def test__get_fixed_ip_address_invalid_ip( self ) : #NEWLINE# #INDENT# port_id = 'fake-port-id' #NEWLINE# api = dhcp_factory . DHCPFactory ( ) . provider #NEWLINE# port_data = { #NEWLINE# #INDENT# 'id' : port_id , #NEWLINE# 'network_id' : '3cb9bc59-5699-4588-a4b1-b87f96708bc6' , #NEWLINE# 'admin_state_up' : True , #NEWLINE# 'status' : 'ACTIVE' , #NEWLINE# 'mac_address' : 'fa:16:3e:4c:2c:30' , #NEWLINE# 'fixed_ips' : [ { #NEWLINE# #INDENT# 'ip_address' : 'invalid.ip' , #NEWLINE# 'subnet_id' : 'f8a6e8f8-c2ec-497c-9f23-da9616de54ef' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'device_id' : 'bece68a3-2f8b-4e66-9092-244493d6aba7' , #NEWLINE# #UNINDENT# } #NEWLINE# fake_client = mock . Mock ( ) #NEWLINE# fake_client . show_port . return_value = { #NEWLINE# #INDENT# 'port' : port_data , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertRaises ( exception . InvalidIPv4Address , api . _get_fixed_ip_address , port_id , fake_client ) #NEWLINE# fake_client . show_port . assert_called_once_with ( port_id )