File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -245,6 +245,28 @@ def test_copy_existing_file_with_user_project(self):
245245 for blob in to_delete :
246246 retry_429 (blob .delete )()
247247
248+ @unittest .skipUnless (USER_PROJECT , 'USER_PROJECT not set in environment.' )
249+ def test_bucket_get_blob_with_user_project (self ):
250+ new_bucket_name = 'w-requester-pays' + unique_resource_id ('-' )
251+ data = b'DEADBEEF'
252+ created = Config .CLIENT .create_bucket (
253+ new_bucket_name , requester_pays = True )
254+ self .case_buckets_to_delete .append (new_bucket_name )
255+ self .assertEqual (created .name , new_bucket_name )
256+ self .assertTrue (created .requester_pays )
257+
258+ with_user_project = Config .CLIENT .bucket (
259+ new_bucket_name , user_project = USER_PROJECT )
260+
261+ self .assertIsNone (with_user_project .get_blob ('nonesuch' ))
262+ to_add = created .blob ('blob-name' )
263+ to_add .upload_from_string (data )
264+ try :
265+ found = with_user_project .get_blob ('blob-name' )
266+ self .assertEqual (found .download_as_string (), data )
267+ finally :
268+ to_add .delete ()
269+
248270
249271class TestStorageFiles (unittest .TestCase ):
250272
You can’t perform that action at this time.
0 commit comments