File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -652,6 +652,32 @@ def test_compose_replace_existing_blob(self):
652652 composed = original .download_as_string ()
653653 self .assertEqual (composed , BEFORE + TO_APPEND )
654654
655+ @unittest .skipUnless (USER_PROJECT , 'USER_PROJECT not set in environment.' )
656+ def test_compose_with_user_project (self ):
657+ new_bucket_name = 'compose-user-project' + unique_resource_id ('-' )
658+ created = Config .CLIENT .create_bucket (
659+ new_bucket_name , requester_pays = True )
660+ try :
661+ SOURCE_1 = b'AAA\n '
662+ source_1 = created .blob ('source-1' )
663+ source_1 .upload_from_string (SOURCE_1 )
664+
665+ SOURCE_2 = b'BBB\n '
666+ source_2 = created .blob ('source-2' )
667+ source_2 .upload_from_string (SOURCE_2 )
668+
669+ with_user_project = Config .CLIENT .bucket (
670+ new_bucket_name , user_project = USER_PROJECT )
671+
672+ destination = with_user_project .blob ('destination' )
673+ destination .content_type = 'text/plain'
674+ destination .compose ([source_1 , source_2 ])
675+
676+ composed = destination .download_as_string ()
677+ self .assertEqual (composed , SOURCE_1 + SOURCE_2 )
678+ finally :
679+ retry_429 (created .delete )(force = True )
680+
655681
656682class TestStorageRewrite (TestStorageFiles ):
657683
You can’t perform that action at this time.
0 commit comments