Fix unconfirm for swift backend

Users can't unconfirm the subscription when use swift backend.

This patch fixed this error.

Change-Id: Ie3da9b767f02f96ccd99ed8c148a2940e519b3cd
This commit is contained in:
wangxiyuan 2017-08-08 10:18:57 +08:00
parent 900bdbe3d9
commit 613da305b2
2 changed files with 8 additions and 3 deletions

View File

@ -157,4 +157,4 @@ class SubscriptionController(storage.Subscription):
return self.get(queue, obj, project)
def confirm(self, queue, subscription_id, project=None, confirmed=True):
self.update(queue, subscription_id, project, confirmed=True)
self.update(queue, subscription_id, project, confirmed=confirmed)

View File

@ -1321,7 +1321,6 @@ class SubscriptionControllerTest(ControllerBaseTest):
s_id, self.project)
subscription = self.subscription_controller.get(self.source, s_id,
project=self.project)
self.assertFalse(subscription['confirmed'])
self.subscription_controller.confirm(self.source, s_id,
@ -1329,9 +1328,15 @@ class SubscriptionControllerTest(ControllerBaseTest):
confirmed=True)
subscription = self.subscription_controller.get(self.source, s_id,
project=self.project)
self.assertTrue(subscription['confirmed'])
self.subscription_controller.confirm(self.source, s_id,
project=self.project,
confirmed=False)
subscription = self.subscription_controller.get(self.source, s_id,
project=self.project)
self.assertFalse(subscription['confirmed'])
def test_confirm_with_nonexist_subscription(self):
s_id = 'fake-id'
self.assertRaises(errors.SubscriptionDoesNotExist,