summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlistair Coles <alistair.coles@hpe.com>2016-01-29 11:16:37 +0000
committerAlistair Coles <alistair.coles@hpe.com>2016-02-01 10:09:30 +0000
commit14a0447491aa1693b8ca5ef36ab69bed5d44a1e6 (patch)
tree46ae6bb47e9094edbaf1ca51ecf6892b46867776
parent0fe02eb1c006d7d70f638f8012aa370fdf4b6096 (diff)
downloadpython-swiftclient-14a0447491aa1693b8ca5ef36ab69bed5d44a1e6.tar.gz
Fix intermittent fail of test_delete_account
The test asserts calls made in specific order, but they are made from threads so may be in different order. Change-Id: I1b6e7303fe0e6fb2afc7da3462b891feab90bc17 Closes-Bug: #1539536
-rw-r--r--tests/unit/test_shell.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py
index 01288c1..ead4aa0 100644
--- a/tests/unit/test_shell.py
+++ b/tests/unit/test_shell.py
@@ -734,14 +734,16 @@ class TestShell(testtools.TestCase):
argv = ["", "delete", "--all"]
connection.return_value.head_object.return_value = {}
swiftclient.shell.main(argv)
- self.assertEqual(
- connection.return_value.delete_object.mock_calls, [
- mock.call('container', 'object', query_string=None,
- response_dict={}),
- mock.call('container', 'obj\xe9ct2', query_string=None,
- response_dict={}),
- mock.call('container2', 'object', query_string=None,
- response_dict={})])
+ connection.return_value.delete_object.assert_has_calls([
+ mock.call('container', 'object', query_string=None,
+ response_dict={}),
+ mock.call('container', 'obj\xe9ct2', query_string=None,
+ response_dict={}),
+ mock.call('container2', 'object', query_string=None,
+ response_dict={})], any_order=True)
+ self.assertEqual(3, connection.return_value.delete_object.call_count,
+ 'Expected 3 calls but found\n%r'
+ % connection.return_value.delete_object.mock_calls)
self.assertEqual(
connection.return_value.delete_container.mock_calls, [
mock.call('container', response_dict={}),