Skip to content

Commit

Permalink
fix: self-upload files for Unicode system test (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsg authored Oct 15, 2020
1 parent fcd1c4f commit 6f865d9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions tests/system/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down

0 comments on commit 6f865d9

Please sign in to comment.