Revision 326c3ec8 snf-cyclades-app/synnefo/api/tests/servers.py

b/snf-cyclades-app/synnefo/api/tests/servers.py
37 37
from snf_django.utils.testing import (BaseAPITest, mocked_quotaholder,
38 38
                                      override_settings)
39 39
from synnefo.db.models import (VirtualMachine, VirtualMachineMetadata,
40
                               FloatingIP)
40
                               IPAddress)
41 41
from synnefo.db import models_factory as mfactory
42 42
from synnefo.logic.utils import get_rsapi_state
43 43
from synnefo.cyclades_settings import cyclades_services
......
468 468
        mfactory.BackendNetworkFactory(network=network,
469 469
                                       backend=self.backend,
470 470
                                       operstate="ACTIVE")
471
        fp1 = mfactory.FloatingIPFactory(ipv4="10.0.0.2",
471
        fp1 = mfactory.IPAddressFactory(ipv4="10.0.0.2",
472 472
                                         userid="test_user",
473 473
                                         network=network, machine=None)
474
        fp2 = mfactory.FloatingIPFactory(ipv4="10.0.0.3", network=network,
474
        fp2 = mfactory.IPAddressFactory(ipv4="10.0.0.3", network=network,
475 475
                                         userid="test_user",
476 476
                                         machine=None)
477 477
        request["server"]["floating_ips"] = [fp1.ipv4, fp2.ipv4]
......
483 483
        self.assertEqual(response.status_code, 202)
484 484
        api_server = json.loads(response.content)['server']
485 485
        vm = VirtualMachine.objects.get(id=api_server["id"])
486
        fp1 = FloatingIP.objects.get(id=fp1.id)
487
        fp2 = FloatingIP.objects.get(id=fp2.id)
486
        fp1 = IPAddress.objects.get(id=fp1.id)
487
        fp2 = IPAddress.objects.get(id=fp2.id)
488 488
        self.assertEqual(fp1.machine, vm)
489 489
        self.assertEqual(fp2.machine, vm)
490 490
        name, args, kwargs = mrapi().CreateInstance.mock_calls[2]

Also available in: Unified diff