summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-02-04 02:48:11 +0000
committerGerrit Code Review <review@openstack.org>2016-02-04 02:48:11 +0000
commitd2ee01bfe4bc8ac864d8f10ef657e6ce45168d9c (patch)
tree80a4e41f91d4b49040431dc9242e9766696d913f
parentda27ad11ccb72664bd8a13c166ab8965438a9cdc (diff)
parentfa9251a1ee9bfc27664d88c5fe6bbb23e8fa1e51 (diff)
downloadpython-swiftclient-d2ee01bfe4bc8ac864d8f10ef657e6ce45168d9c.tar.gz
Merge "Fix intermittent fail of test_delete_bulk_account"
-rw-r--r--tests/unit/test_shell.py41
1 files changed, 25 insertions, 16 deletions
diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py
index 00546f6..c7bbf74 100644
--- a/tests/unit/test_shell.py
+++ b/tests/unit/test_shell.py
@@ -791,22 +791,31 @@ class TestShell(testtools.TestCase):
b'"Errors": [], "Number Deleted": 1, "Response Body": ""}')
swiftclient.shell.main(argv)
self.assertEqual(
- connection.return_value.post_account.mock_calls, [
- mock.call(query_string='bulk-delete',
- data=b'/container/object\n/container/obj%C3%A9ct2\n',
- headers={'Content-Type': 'text/plain',
- 'Accept': 'application/json'},
- response_dict={}),
- mock.call(query_string='bulk-delete',
- data=b'/container/object3\n',
- headers={'Content-Type': 'text/plain',
- 'Accept': 'application/json'},
- response_dict={}),
- mock.call(query_string='bulk-delete',
- data=b'/container2/object\n',
- headers={'Content-Type': 'text/plain',
- 'Accept': 'application/json'},
- response_dict={})])
+ 3, len(connection.return_value.post_account.mock_calls),
+ 'Expected 3 calls but found\n%r'
+ % connection.return_value.post_account.mock_calls)
+ # POSTs for same container are made in parallel so expect any order
+ for expected in [
+ mock.call(query_string='bulk-delete',
+ data=b'/container/object\n/container/obj%C3%A9ct2\n',
+ headers={'Content-Type': 'text/plain',
+ 'Accept': 'application/json'},
+ response_dict={}),
+ mock.call(query_string='bulk-delete',
+ data=b'/container/object3\n',
+ headers={'Content-Type': 'text/plain',
+ 'Accept': 'application/json'},
+ response_dict={})]:
+ self.assertIn(expected,
+ connection.return_value.post_account.mock_calls[:2])
+ # POSTs for different containers are made sequentially so expect order
+ self.assertEqual(
+ mock.call(query_string='bulk-delete',
+ data=b'/container2/object\n',
+ headers={'Content-Type': 'text/plain',
+ 'Accept': 'application/json'},
+ response_dict={}),
+ connection.return_value.post_account.mock_calls[2])
self.assertEqual(
connection.return_value.delete_container.mock_calls, [
mock.call('container', response_dict={}),