summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-01-22 13:16:44 +0000
committerGerrit Code Review <review@openstack.org>2016-01-22 13:16:44 +0000
commite65e01014e8f0c81e137116c7cb2c0de256ee5bd (patch)
tree8fa9ea79cd2c0fd76223c5b2bb4e3c0839846e7f /tests
parent88874ae4411e025172262165e96fd2907a66ab7d (diff)
parentee8c1bab9873c0bf87a12ebebc4a12c233586687 (diff)
downloadpython-swiftclient-e65e01014e8f0c81e137116c7cb2c0de256ee5bd.tar.gz
Merge "Convert http response(byte string) to string in python3."
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_shell.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py
index 13c2663..01288c1 100644
--- a/tests/unit/test_shell.py
+++ b/tests/unit/test_shell.py
@@ -531,6 +531,27 @@ class TestShell(testtools.TestCase):
'x-object-meta-mtime': mock.ANY},
response_dict={})
+ @mock.patch('swiftclient.service.SwiftService.upload')
+ def test_upload_object_with_account_readonly(self, upload):
+ argv = ["", "upload", "container", self.tmpfile]
+ upload.return_value = [
+ {"success": False,
+ "headers": {},
+ "action": 'create_container',
+ "error": swiftclient.ClientException(
+ 'Container PUT failed',
+ http_status=403,
+ http_reason='Forbidden',
+ http_response_content=b'<html><h1>Forbidden</h1>')
+ }]
+
+ with CaptureOutput() as output:
+ swiftclient.shell.main(argv)
+ self.assertTrue(output.err != '')
+ warning_msg = "Warning: failed to create container 'container': " \
+ "403 Forbidden"
+ self.assertTrue(output.err.startswith(warning_msg))
+
@mock.patch('swiftclient.service.Connection')
def test_upload_delete_slo_segments(self, connection):
# Upload delete existing segments