From 6f865d97a19278884356055dfeeaae92f7c63cc1 Mon Sep 17 00:00:00 2001 From: Andrew Gorcester Date: Thu, 15 Oct 2020 13:15:46 -0700 Subject: [PATCH] fix: self-upload files for Unicode system test (#296) --- tests/system/test_system.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/system/test_system.py b/tests/system/test_system.py index e6636b41d..4898dc061 100644 --- a/tests/system/test_system.py +++ b/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):