Fix assert error during queue creating in ut

In some concurrent test case, the queue may be created
more than one time in the setup function. Since the queue
in Zaqar is lazy, it returns 201 or 204 in this case.

Change-Id: I1c8163a5cfb10071650b5ae16cc53d61503621a2
Closes-bug: #1753997
This commit is contained in:
wangxiyuan 2018-03-08 14:55:36 +08:00
parent 4840509fc7
commit 8e0dd9763a
3 changed files with 3 additions and 3 deletions

View File

@ -47,7 +47,7 @@ class ClaimsBaseTest(base.V1_1Base):
with mock.patch.object(self.protocol, 'sendMessage') as msg_mock:
self.protocol.onMessage(req, False)
resp = json.loads(msg_mock.call_args[0][0])
self.assertEqual(201, resp['headers']['status'])
self.assertIn(resp['headers']['status'], [201, 204])
action = consts.MESSAGE_POST
body = {"queue_name": "skittle",

View File

@ -53,7 +53,7 @@ class MessagesBaseTest(base.V2Base):
with mock.patch.object(self.protocol, 'sendMessage') as msg_mock:
self.protocol.onMessage(req, False)
resp = json.loads(msg_mock.call_args[0][0])
self.assertEqual(201, resp['headers']['status'])
self.assertIn(resp['headers']['status'], [201, 204])
def tearDown(self):
super(MessagesBaseTest, self).tearDown()

View File

@ -48,7 +48,7 @@ class SubscriptionTest(base.V1_1Base):
def validator(resp, isBinary):
resp = json.loads(resp)
self.assertEqual(resp['headers']['status'], 201)
self.assertIn(resp['headers']['status'], [201, 204])
with mock.patch.object(self.protocol, 'sendMessage') as msg_mock:
msg_mock.side_effect = validator