@@ -1018,18 +1018,24 @@ def test_get_blob_hit_w_user_project(self):
10181018 _target_object = blob ,
10191019 )
10201020
1021- def test_get_blob_hit_w_generation_w_soft_deleted (self ):
1021+ def test_get_blob_hit_w_gen_soft_deleted_restore_token (self ):
10221022 from google .cloud .storage .blob import Blob
10231023
10241024 name = "name"
10251025 blob_name = "blob-name"
10261026 generation = 1512565576797178
1027+ restore_token = "88ba0d97-639e-5902"
10271028 api_response = {"name" : blob_name , "generation" : generation }
10281029 client = mock .Mock (spec = ["_get_resource" ])
10291030 client ._get_resource .return_value = api_response
10301031 bucket = self ._make_one (client , name = name )
10311032
1032- blob = bucket .get_blob (blob_name , generation = generation , soft_deleted = True )
1033+ blob = bucket .get_blob (
1034+ blob_name ,
1035+ generation = generation ,
1036+ soft_deleted = True ,
1037+ restore_token = restore_token ,
1038+ )
10331039
10341040 self .assertIsInstance (blob , Blob )
10351041 self .assertIs (blob .bucket , bucket )
@@ -1041,6 +1047,7 @@ def test_get_blob_hit_w_generation_w_soft_deleted(self):
10411047 "generation" : generation ,
10421048 "projection" : "noAcl" ,
10431049 "softDeleted" : True ,
1050+ "restoreToken" : restore_token ,
10441051 }
10451052 expected_headers = {}
10461053 client ._get_resource .assert_called_once_with (
@@ -4217,8 +4224,10 @@ def test_restore_blob_w_explicit(self):
42174224 user_project = "user-project-123"
42184225 bucket_name = "restore_bucket"
42194226 blob_name = "restore_blob"
4227+ new_generation = 987655
42204228 generation = 123456
4221- api_response = {"name" : blob_name , "generation" : generation }
4229+ restore_token = "88ba0d97-639e-5902"
4230+ api_response = {"name" : blob_name , "generation" : new_generation }
42224231 client = mock .Mock (spec = ["_post_resource" ])
42234232 client ._post_resource .return_value = api_response
42244233 bucket = self ._make_one (
@@ -4233,6 +4242,8 @@ def test_restore_blob_w_explicit(self):
42334242 restored_blob = bucket .restore_blob (
42344243 blob_name ,
42354244 client = client ,
4245+ generation = generation ,
4246+ restore_token = restore_token ,
42364247 if_generation_match = if_generation_match ,
42374248 if_generation_not_match = if_generation_not_match ,
42384249 if_metageneration_match = if_metageneration_match ,
@@ -4245,6 +4256,8 @@ def test_restore_blob_w_explicit(self):
42454256 expected_path = f"/b/{ bucket_name } /o/{ blob_name } /restore"
42464257 expected_data = None
42474258 expected_query_params = {
4259+ "generation" : generation ,
4260+ "restoreToken" : restore_token ,
42484261 "userProject" : user_project ,
42494262 "projection" : projection ,
42504263 "ifGenerationMatch" : if_generation_match ,
0 commit comments