summaryrefslogtreecommitdiff
path: root/nova/tests/network/test_manager.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-08-05 05:36:03 +0000
committerGerrit Code Review <review@openstack.org>2014-08-05 05:36:03 +0000
commit7d85ac78928def5e3295253de32bdf1a94419cd5 (patch)
tree9ebc8e5cfa60fa0702002b071cb7aa705dbf6d08 /nova/tests/network/test_manager.py
parent4e332e468b21636c3c3953180ae98bf2c609ba3f (diff)
parent77a7d14542600f2badcdf048fe6b586a0ff27e30 (diff)
downloadnova-7d85ac78928def5e3295253de32bdf1a94419cd5.tar.gz
Merge "Commit quota when deallocate floating ip"
Diffstat (limited to 'nova/tests/network/test_manager.py')
-rw-r--r--nova/tests/network/test_manager.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/nova/tests/network/test_manager.py b/nova/tests/network/test_manager.py
index fd0f534f87..694f3d6e11 100644
--- a/nova/tests/network/test_manager.py
+++ b/nova/tests/network/test_manager.py
@@ -1103,12 +1103,14 @@ class VlanNetworkTestCase(test.TestCase):
self.network.allocate_floating_ip(ctxt, ctxt.project_id)
- def test_deallocate_floating_ip(self):
+ @mock.patch('nova.quota.QUOTAS.reserve')
+ @mock.patch('nova.quota.QUOTAS.commit')
+ def test_deallocate_floating_ip(self, mock_commit, mock_reserve):
ctxt = context.RequestContext('testuser', 'testproject',
is_admin=False)
def fake1(*args, **kwargs):
- pass
+ return dict(test_floating_ip.fake_floating_ip)
def fake2(*args, **kwargs):
return dict(test_floating_ip.fake_floating_ip,
@@ -1129,10 +1131,14 @@ class VlanNetworkTestCase(test.TestCase):
ctxt,
mox.IgnoreArg())
+ mock_reserve.return_value = 'reserve'
# this time should not raise
self.stubs.Set(self.network.db, 'floating_ip_get_by_address', fake3)
self.network.deallocate_floating_ip(ctxt, ctxt.project_id)
+ mock_commit.assert_called_once_with(ctxt, 'reserve',
+ project_id='testproject')
+
@mock.patch('nova.db.fixed_ip_get')
def test_associate_floating_ip(self, fixed_get):
ctxt = context.RequestContext('testuser', 'testproject',