Commit e58d2db1 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Various fixes to tests

parent 2eac0aad
......@@ -265,9 +265,10 @@ class NetworkAPITest(BaseAPITest):
self.assertFault(response, 403, 'forbidden')
def test_delete_network(self, mrapi):
net = mfactory.NetworkFactory()
response = self.delete('/api/v1.1/networks/%d' % net.id,
net.userid)
net = mfactory.NetworkFactory(deleted=False, state='ACTIVE')
with mocked_quotaholder():
response = self.delete('/api/v1.1/networks/%d' % net.id,
net.userid)
self.assertEqual(response.status_code, 204)
net = Network.objects.get(id=net.id, userid=net.userid)
self.assertEqual(net.action, 'DESTROY')
......
......@@ -426,6 +426,7 @@ class UpdateNetworkTest(TestCase):
link='prv12')
bn1 = mfactory.BackendNetworkFactory(network=net)
mfactory.BackendNetworkFactory(network=net,
operstate="ACTIVE",
backend__offline=True)
msg = self.create_msg(operation='OP_NETWORK_REMOVE',
network=net.backend_id,
......@@ -438,8 +439,10 @@ class UpdateNetworkTest(TestCase):
self.assertFalse(new_net.deleted)
def test_error_opcode(self, client):
mfactory.MacPrefixPoolTableFactory()
mfactory.BridgePoolTableFactory()
for state, _ in Network.OPER_STATES:
bn = mfactory.BackendNetworkFactory()
bn = mfactory.BackendNetworkFactory(operstate="ACTIVE")
bn.operstate = state
bn.save()
network = bn.network
......@@ -451,8 +454,11 @@ class UpdateNetworkTest(TestCase):
msg = self.create_msg(operation=opcode,
network=bn.network.backend_id,
status='error',
add_reserved_ips=[],
remove_reserved_ips=[],
cluster=bn.backend.clustername)
update_network(client, msg)
with mocked_quotaholder():
update_network(client, msg)
client.basic_ack.assert_called_once()
db_bnet = BackendNetwork.objects.get(id=bn.id)
self.assertEqual(bn.operstate, db_bnet.operstate)
......
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