diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-06-06 10:33:25 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-06-06 10:33:25 +0000 |
| commit | c91c8d575e86b480270f8dfb7df49355dd38ee54 (patch) | |
| tree | ee60b5dfa7a88a2e607c02f84a885ac4b1fa99d2 /tests/unit/test_shell.py | |
| parent | e1e2678cd0a99955c280a813e10c6ce7494389cd (diff) | |
| parent | 69bf4634b972ef2ee0ec1f015d71223203f0bb1a (diff) | |
| download | python-swiftclient-c91c8d575e86b480270f8dfb7df49355dd38ee54.tar.gz | |
Merge "Add an option: disable etag check on downloads"
Diffstat (limited to 'tests/unit/test_shell.py')
| -rw-r--r-- | tests/unit/test_shell.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py index 0639ac1..59f0d5f 100644 --- a/tests/unit/test_shell.py +++ b/tests/unit/test_shell.py @@ -367,6 +367,24 @@ class TestShell(unittest.TestCase): mock_open.assert_called_with('object', 'wb') self.assertEqual([], makedirs.mock_calls) + # Test downloading without md5 checks + objcontent = six.BytesIO(b'objcontent') + connection.return_value.get_object.side_effect = [ + ({'content-type': 'text/plain', + 'etag': '2cbbfe139a744d6abbe695e17f3c1991'}, + objcontent) + ] + with mock.patch(BUILTIN_OPEN) as mock_open, mock.patch( + 'swiftclient.service._SwiftReader') as sr: + argv = ["", "download", "container", "object", "--ignore-check"] + swiftclient.shell.main(argv) + connection.return_value.get_object.assert_called_with( + 'container', 'object', headers={}, resp_chunk_size=65536, + response_dict={}) + mock_open.assert_called_with('object', 'wb') + sr.assert_called_once_with('object', mock.ANY, mock.ANY, False) + self.assertEqual([], makedirs.mock_calls) + # Test downloading single object to stdout objcontent = six.BytesIO(b'objcontent') connection.return_value.get_object.side_effect = [ |
