Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8ba10f0

Browse filesBrowse files
committed
Test 'Blob.compose' w/ 'user_project' set. (#4092)
1 parent 614d2e9 commit 8ba10f0
Copy full SHA for 8ba10f0

File tree

Expand file treeCollapse file tree

1 file changed

+26
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+26
-0
lines changed

‎storage/tests/system.py

Copy file name to clipboardExpand all lines: storage/tests/system.py
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,32 @@ def test_compose_replace_existing_blob(self):
650650
composed = original.download_as_string()
651651
self.assertEqual(composed, BEFORE + TO_APPEND)
652652

653+
@unittest.skipUnless(USER_PROJECT, 'USER_PROJECT not set in environment.')
654+
def test_compose_with_user_project(self):
655+
new_bucket_name = 'compose-user-project' + unique_resource_id('-')
656+
created = Config.CLIENT.create_bucket(
657+
new_bucket_name, requester_pays=True)
658+
try:
659+
SOURCE_1 = b'AAA\n'
660+
source_1 = created.blob('source-1')
661+
source_1.upload_from_string(SOURCE_1)
662+
663+
SOURCE_2 = b'BBB\n'
664+
source_2 = created.blob('source-2')
665+
source_2.upload_from_string(SOURCE_2)
666+
667+
with_user_project = Config.CLIENT.bucket(
668+
new_bucket_name, user_project=USER_PROJECT)
669+
670+
destination = with_user_project.blob('destination')
671+
destination.content_type = 'text/plain'
672+
destination.compose([source_1, source_2])
673+
674+
composed = destination.download_as_string()
675+
self.assertEqual(composed, SOURCE_1 + SOURCE_2)
676+
finally:
677+
retry_429(created.delete)(force=True)
678+
653679

654680
class TestStorageRewrite(TestStorageFiles):
655681

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.