Commit 9b56728c authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Fix some broking tests

parent 0e97cb82
......@@ -33,7 +33,7 @@
from django.utils import simplejson as json
from snf_django.utils.testing import BaseAPITest, mocked_quotaholder
from synnefo.db.models import IPAddress, Network
from synnefo.db.models import IPAddress, Network, Subnet, IPPoolTable
from synnefo.db import models_factory as mf
from mock import patch, Mock
......@@ -127,6 +127,8 @@ class FloatingIPAPITest(BaseAPITest):
"""Test reserve FIP without specifying network."""
request = {"floatingip": {}}
# delete all pools..
IPPoolTable.objects.all().delete()
Subnet.objects.all().delete()
Network.objects.all().delete()
# CASE: no floating IP pool
with mocked_quotaholder():
......
......@@ -244,28 +244,7 @@ class NetworkReconciliationTest(TestCase):
"external_reservations": ""}]
self.reconciler.reconcile_networks()
self.assertTrue(net1.backend_networks
.filter(backend=self.backend).exists())
# ..but not if it is destroying
net1.backend_networks.all().delete()
net1.action = "DESTROY"
net1.save()
self.reconciler.reconcile_networks()
self.assertFalse(net1.backend_networks
.filter(backend=self.backend).exists())
# or network is public!
net1.action = "CREATE"
net1.public = True
net1.save()
self.reconciler.reconcile_networks()
self.assertFalse(net1.backend_networks
.filter(backend=self.backend).exists())
# Test creation if network is a floating IP pool
net2 = mfactory.NetworkWithSubnetFactory(floating_ip_pool=True)
mrapi().GetNetworks.return_value = []
self.assertEqual(net2.backend_networks.count(), 0)
self.reconciler.reconcile_networks()
self.assertTrue(net2.backend_networks
.filter(backend=self.backend).exists())
.filter(backend=self.backend).exists())
def test_stale_network(self, mrapi):
# Test that stale network will be deleted from DB, if network action is
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment