Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: self-upload files for Unicode system test #296

Merged
merged 1 commit into from Oct 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 11 additions & 7 deletions tests/system/test_system.py
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