From 613da305b2893913b7190b8c6b152e426cc9a285 Mon Sep 17 00:00:00 2001 From: wangxiyuan Date: Tue, 8 Aug 2017 10:18:57 +0800 Subject: [PATCH] Fix unconfirm for swift backend Users can't unconfirm the subscription when use swift backend. This patch fixed this error. Change-Id: Ie3da9b767f02f96ccd99ed8c148a2940e519b3cd --- zaqar/storage/swift/subscriptions.py | 2 +- zaqar/tests/unit/storage/base.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/zaqar/storage/swift/subscriptions.py b/zaqar/storage/swift/subscriptions.py index 0058fed3d..6d36bcb73 100644 --- a/zaqar/storage/swift/subscriptions.py +++ b/zaqar/storage/swift/subscriptions.py @@ -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) diff --git a/zaqar/tests/unit/storage/base.py b/zaqar/tests/unit/storage/base.py index 57622505e..3f63521bc 100644 --- a/zaqar/tests/unit/storage/base.py +++ b/zaqar/tests/unit/storage/base.py @@ -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,