]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix typo in cinder/db/api.py
authorOllie Leahy <oliver.leahy@hp.com>
Tue, 29 Jan 2013 11:25:27 +0000 (11:25 +0000)
committerOllie Leahy <oliver.leahy@hp.com>
Tue, 29 Jan 2013 11:25:27 +0000 (11:25 +0000)
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
cinder/tests/test_quota.py

index 7aa00ab787257152536c65f4460e5db7d6433065..0b2ab8d8882ab5ba472dcf98d0b86a4ecaf1e1a3 100644 (file)
@@ -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):
index 6610f7a35522394d3e89f98c78507a0bd642f719..fc7395b98b8d3886539b6fcd259d492d92a64436 100644 (file)
@@ -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):