summaryrefslogtreecommitdiff
path: root/tests/unit/test_shell.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-08-17 19:08:15 +0000
committerGerrit Code Review <review@openstack.org>2014-08-17 19:08:15 +0000
commiteedb0d4ab5f2fc6ac8b49a80cd2128edcbc5aceb (patch)
treef164ecc7671147bc9092bb77ec4942af5a3f1100 /tests/unit/test_shell.py
parent23474b7d11b8d9fc97b315062a237c2d5aec19a4 (diff)
parent3d56b65c898d7997819f2627a2fb722bd0c33b69 (diff)
downloadpython-swiftclient-eedb0d4ab5f2fc6ac8b49a80cd2128edcbc5aceb.tar.gz
Merge "Fix crash when downloading a pseudo-directory"
Diffstat (limited to 'tests/unit/test_shell.py')
-rw-r--r--tests/unit/test_shell.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py
index 246235f..46a43ad 100644
--- a/tests/unit/test_shell.py
+++ b/tests/unit/test_shell.py
@@ -183,6 +183,7 @@ class TestShell(unittest.TestCase):
# Test downloading whole container
connection.return_value.get_container.side_effect = [
[None, [{'name': 'object'}]],
+ [None, [{'name': 'pseudo/'}]],
[None, []],
]
connection.return_value.auth_end_time = 0
@@ -191,9 +192,13 @@ class TestShell(unittest.TestCase):
with mock.patch(BUILTIN_OPEN) as mock_open:
argv = ["", "download", "container"]
swiftclient.shell.main(argv)
- connection.return_value.get_object.assert_called_with(
- 'container', 'object', headers={}, resp_chunk_size=65536)
- mock_open.assert_called_with('object', 'wb')
+ calls = [mock.call('container', 'object',
+ headers={}, resp_chunk_size=65536),
+ mock.call('container', 'pseudo/',
+ headers={}, resp_chunk_size=65536)]
+ connection.return_value.get_object.assert_has_calls(
+ calls, any_order=True)
+ mock_open.assert_called_once_with('object', 'wb')
# Test downloading single object
with mock.patch(BUILTIN_OPEN) as mock_open: