def test_sync_object_utf8(self): utf_obj = "யாமறிந்த" body = "FOO" new_connect = fake_http_connect(200, body) self.stubs.Set(swift.common.bufferedhttp, '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)) self.assertEqual(utf_obj, name) self.stubs.Set(swobjects.swiftclient, 'put_object', put_object) swobjects.sync_object(self.orig_storage_url, "token", self.dest_storage_url, "token", "contגלאָז", ("etag", utf_obj))
def test_sync_object(self): body = ("X" * 3) * 1024 new_connect = fake_http_connect(200, body) self.stubs.Set(swift.common.bufferedhttp, 'http_connect_raw', new_connect) def put_object(url, name=None, headers=None, contents=None): self.assertEqual('obj1', name) self.assertIn('x-auth-token', headers) self.assertIsInstance(contents, FileLikeIter) contents_read = contents.read() self.assertEqual(len(contents_read), len(body)) self.stubs.Set(swobjects.swiftclient, 'put_object', put_object) swobjects.sync_object(self.orig_storage_url, "token", self.dest_storage_url, "token", "cont1", ("etag", "obj1"))