From b79e1f485c85cbb16280adc8d590886e25694c87 Mon Sep 17 00:00:00 2001 From: Ollie Leahy Date: Tue, 29 Jan 2013 11:25:27 +0000 Subject: [PATCH] Fix typo in cinder/db/api.py The api method quota_destroy_all_by_project() calls the implementation quota_get_all_by_project() Change-Id: I11927e1fd29c6248ce755dfd236bf0f9adf39d94 Fixes: bug #1108766 --- cinder/db/api.py | 2 +- cinder/tests/test_quota.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cinder/db/api.py b/cinder/db/api.py index 7aa00ab78..0b2ab8d88 100644 --- a/cinder/db/api.py +++ b/cinder/db/api.py @@ -657,7 +657,7 @@ def reservation_rollback(context, reservations): def quota_destroy_all_by_project(context, project_id): """Destroy all quotas associated with a given project.""" - return IMPL.quota_get_all_by_project(context, project_id) + return IMPL.quota_destroy_all_by_project(context, project_id) def reservation_expire(context): diff --git a/cinder/tests/test_quota.py b/cinder/tests/test_quota.py index 6610f7a35..fc7395b98 100644 --- a/cinder/tests/test_quota.py +++ b/cinder/tests/test_quota.py @@ -857,6 +857,21 @@ class DbQuotaDriverTestCase(test.TestCase): ('quota_reserve', expire, 0, 86400), ]) self.assertEqual(result, ['resv-1', 'resv-2', 'resv-3']) + def _stub_quota_destroy_all_by_project(self): + def fake_quota_destroy_all_by_project(context, project_id): + self.calls.append(('quota_destroy_all_by_project', project_id)) + return None + self.stubs.Set(sqa_api, 'quota_destroy_all_by_project', + fake_quota_destroy_all_by_project) + + def test_destroy_by_project(self): + self._stub_quota_destroy_all_by_project() + self.driver.destroy_all_by_project(FakeContext('test_project', + 'test_class'), + 'test_project') + self.assertEqual(self.calls, [('quota_destroy_all_by_project', + ('test_project')), ]) + class FakeSession(object): def begin(self): -- 2.45.2