'Ensure release fails if a port is still associated with it.
If the floating IP has a port associated with it, as indicated by a
configured port_id, then any attempt to release should fail.'

@mock.patch('nova.network.neutronv2.api.get_client')
@mock.patch('nova.network.neutronv2.api.API._get_floating_ip_by_address', return_value={'port_id': 'abc', 'id': 'abc'})
def test_release_floating_ip_associated(self, mock_get_ip, mock_ntrn):

    mock_nc = mock.Mock()
    mock_ntrn.return_value = mock_nc
    address = '172.24.4.227'
    self.assertRaises(exception.FloatingIpAssociated, self.api.release_floating_ip, self.context, address)
