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

b/snf-cyclades-app/synnefo/api/tests/servers.py
498 498
                               DEFAULT_INSTANCE_NETWORKS=["SNF:ANY_PUBLIC"]):
499 499
            response = self.mypost('servers', 'test_user',
500 500
                                   json.dumps(request), 'json')
501
        self.assertFault(response, 403, "forbidden")
501
        self.assertBadRequest(response)
502 502

  
503 503
        # test wrong user
504 504
        request = deepcopy(self.request)
......
512 512

  
513 513
        # Test floating IPs
514 514
        request = deepcopy(self.request)
515
        request["server"]["networks"] = [{"uuid": bnet1.network.id}]
516 515
        fp1 = mfactory.FloatingIPFactory(address="10.0.0.2",
517 516
                                         userid="test_user",
518 517
                                         network=self.network,
......
521 520
                                         userid="test_user",
522 521
                                         network=self.network,
523 522
                                         nic=None)
524
        request["server"]["floating_ips"] = [fp1.id, fp2.id]
523
        request["server"]["networks"] = [{"uuid": bnet1.network.id},
524
                                         {"uuid": fp1.network.id,
525
                                          "fixed_ip": fp1.address},
526
                                         {"uuid": fp2.network.id,
527
                                          "fixed_ip": fp2.address}]
525 528
        with override_settings(settings,
526 529
                               DEFAULT_INSTANCE_NETWORKS=[bnet3.network.id]):
527 530
            with mocked_quotaholder():
......
538 541
        self.assertEqual(len(kwargs["nics"]), 4)
539 542
        self.assertEqual(kwargs["nics"][0]["network"],
540 543
                         bnet3.network.backend_id)
541
        self.assertEqual(kwargs["nics"][1]["network"], fp1.network.backend_id)
542
        self.assertEqual(kwargs["nics"][1]["ip"], fp1.address)
543
        self.assertEqual(kwargs["nics"][2]["network"], fp2.network.backend_id)
544
        self.assertEqual(kwargs["nics"][2]["ip"], fp2.address)
545
        self.assertEqual(kwargs["nics"][3]["network"],
544
        self.assertEqual(kwargs["nics"][1]["network"],
546 545
                         bnet1.network.backend_id)
546
        self.assertEqual(kwargs["nics"][2]["network"], fp1.network.backend_id)
547
        self.assertEqual(kwargs["nics"][2]["ip"], fp1.address)
548
        self.assertEqual(kwargs["nics"][3]["network"], fp2.network.backend_id)
549
        self.assertEqual(kwargs["nics"][3]["ip"], fp2.address)
547 550

  
548 551
    def test_create_server_no_flavor(self, mrapi):
549 552
        request = deepcopy(self.request)

Also available in: Unified diff