Revision 326c3ec8 snf-cyclades-app/synnefo/logic/tests/callbacks.py

b/snf-cyclades-app/synnefo/logic/tests/callbacks.py
34 34

  
35 35
from django.test import TestCase
36 36

  
37
from synnefo.db.models import (VirtualMachine, FloatingIP, BackendNetwork,
37
from synnefo.db.models import (VirtualMachine, IPAddress, BackendNetwork,
38 38
                               Network, BridgePoolTable, MacPrefixPoolTable)
39 39
from synnefo.db import models_factory as mfactory
40 40
from synnefo.lib.utils import split_time
......
151 151
        self.assertTrue(nic.network.get_pool().is_available(nic.ipv4))
152 152
        vm2 = mfactory.VirtualMachineFactory()
153 153
        network = mfactory.NetworkFactory(floating_ip_pool=True)
154
        fp1 = mfactory.FloatingIPFactory(machine=vm2, network=network)
155
        fp2 = mfactory.FloatingIPFactory(machine=vm2, network=network)
154
        fp1 = mfactory.IPAddressFactory(machine=vm2, network=network)
155
        fp2 = mfactory.IPAddressFactory(machine=vm2, network=network)
156 156
        mfactory.NetworkInterfaceFactory(machine=vm2, network=network,
157 157
                                         ipv4=fp1.ipv4)
158 158
        mfactory.NetworkInterfaceFactory(machine=vm2, network=network,
......
169 169
        db_vm = VirtualMachine.objects.get(id=vm.id)
170 170
        self.assertEqual(db_vm.operstate, 'DESTROYED')
171 171
        self.assertTrue(db_vm.deleted)
172
        self.assertEqual(FloatingIP.objects.get(id=fp1.id).machine, None)
173
        self.assertEqual(FloatingIP.objects.get(id=fp2.id).machine, None)
172
        self.assertEqual(IPAddress.objects.get(id=fp1.id).machine, None)
173
        self.assertEqual(IPAddress.objects.get(id=fp2.id).machine, None)
174 174
        pool = network.get_pool()
175 175
        # Test that floating ips are not released
176 176
        self.assertFalse(pool.is_available(fp1.ipv4))

Also available in: Unified diff