Make sure container is quoted but not object.
- Add tests for it.
This commit is contained in:
parent
78fdf2e5fd
commit
6b1f588d8a
@ -92,13 +92,13 @@ def delete_object(dest_cnx,
|
||||
|
||||
def sync_object(orig_storage_url, orig_token, dest_storage_url,
|
||||
dest_token, container_name, object_name_etag):
|
||||
object_name = object_name_etag[1]
|
||||
|
||||
orig_headers, orig_body = get_object(orig_storage_url,
|
||||
orig_token,
|
||||
container_name,
|
||||
object_name_etag[1],
|
||||
)
|
||||
container_name = container_name
|
||||
object_name = object_name_etag[1]
|
||||
object_name)
|
||||
container_name = quote(container_name)
|
||||
|
||||
post_headers = orig_headers
|
||||
post_headers['x-auth-token'] = dest_token
|
||||
|
@ -91,6 +91,23 @@ class TestObject(test_base.TestCase):
|
||||
"token", self.dest_storage_url, "token",
|
||||
"cont1", ("etag", "obj1"))
|
||||
|
||||
def test_sync_object_utf8(self):
|
||||
body = "FOO"
|
||||
new_connect = fake_http_connect(200, body)
|
||||
self.stubs.Set(swobjects, 'http_connect_raw', new_connect)
|
||||
|
||||
def put_object(url, name=None, headers=None, contents=None):
|
||||
# Container is Quoted
|
||||
self.assertFalse(isinstance(url.split("/")[-1], unicode))
|
||||
# name is not quoted
|
||||
self.assertTrue(name, unicode)
|
||||
|
||||
self.stubs.Set(swobjects.swiftclient, 'put_object', put_object)
|
||||
|
||||
swobjects.sync_object(self.orig_storage_url,
|
||||
"token", self.dest_storage_url, "token",
|
||||
"contגלאָז", ("etag", "யாமறிந்த"))
|
||||
|
||||
def test_get_object_chunked(self):
|
||||
chunk_size = 32
|
||||
expected_chunk_time = 3
|
||||
|
Loading…
x
Reference in New Issue
Block a user