Skip to content
Permalink
Browse files
fix: self-upload files for Unicode system test (#296)
  • Loading branch information
andrewsg committed Oct 15, 2020
1 parent fcd1c4f commit 6f865d97a19278884356055dfeeaae92f7c63cc1
Showing with 11 additions and 7 deletions.
  1. +11 −7 tests/system/test_system.py
@@ -1035,13 +1035,12 @@ def test_blob_crc32_md5_hash(self):
self.assertEqual(download_blob.md5_hash, blob.md5_hash)


class TestUnicode(unittest.TestCase):
@vpcsc_config.skip_if_inside_vpcsc
class TestUnicode(TestStorageFiles):
def test_fetch_object_and_check_content(self):
client = storage.Client()
bucket = client.bucket("storage-library-test-bucket")
# Historical note: This test when originally written accessed public
# files with Unicode names. These files are no longer available, so it
# was rewritten to upload them first.

# Note: These files are public.
# Normalization form C: a single character for e-acute;
# URL should end with Cafe%CC%81
# Normalization Form D: an ASCII e followed by U+0301 combining
@@ -1050,10 +1049,15 @@ def test_fetch_object_and_check_content(self):
u"Caf\u00e9": b"Normalization Form C",
u"Cafe\u0301": b"Normalization Form D",
}

for blob_name, file_contents in test_data.items():
blob = bucket.blob(blob_name)
self.assertEqual(blob.name, blob_name)
blob = self.bucket.blob(blob_name)
blob.upload_from_string(file_contents)

for blob_name, file_contents in test_data.items():
blob = self.bucket.blob(blob_name)
self.assertEqual(blob.download_as_bytes(), file_contents)
self.assertEqual(blob.name, blob_name)


class TestStorageListFiles(TestStorageFiles):

0 comments on commit 6f865d9

Please sign in to comment.