|
163 | 163 | returned_bucket_gapi.encryption = bucket_gapi.encryption.dup |
164 | 164 | returned_bucket_gapi.encryption.google_managed_encryption_enforcement_config = patch_bucket_gapi.encryption.google_managed_encryption_enforcement_config |
165 | 165 |
|
166 | | - mock.expect :update_bucket, returned_bucket_gapi do |name, patch_obj, **kwargs| |
167 | | - cm_config = patch_obj.encryption.customer_managed_encryption_enforcement_config |
168 | | - cs_config = patch_obj.encryption.customer_supplied_encryption_enforcement_config |
169 | | - gm_config = patch_obj.encryption.google_managed_encryption_enforcement_config |
170 | | - |
171 | | - end |
| 166 | + mock.expect(:update_bucket, returned_bucket_gapi) { |name,**| name == bucket_name} |
172 | 167 |
|
173 | 168 | bucket.service.mocked_service = mock |
174 | 169 | _(bucket.customer_managed_encryption_enforcement_config.restriction_mode).must_equal "FullyRestricted" |
|
178 | 173 | bucket.update do |b| |
179 | 174 | b.google_managed_encryption_enforcement_config = incoming_config |
180 | 175 | end |
181 | | - # bucket.update_bucket_encryption_enforcement_config incoming_config |
182 | 176 | _(bucket.customer_managed_encryption_enforcement_config.restriction_mode).must_equal "FullyRestricted" |
183 | 177 | _(bucket.customer_supplied_encryption_enforcement_config.restriction_mode).must_equal "NotRestricted" |
184 | 178 | _(bucket.google_managed_encryption_enforcement_config.restriction_mode).must_equal "FullyRestricted" |
|
206 | 200 | initial_bucket_gapi = bucket_gapi.dup |
207 | 201 | initial_bucket_gapi.encryption = bucket_encryption.dup |
208 | 202 | initial_bucket_gapi.encryption.default_kms_key_name = kms_key |
209 | | - |
210 | 203 | bucket_with_configs_and_key = Google::Cloud::Storage::Bucket.from_gapi initial_bucket_gapi, storage.service |
211 | 204 |
|
212 | 205 | returned_bucket_gapi = bucket_gapi.dup |
213 | 206 | returned_bucket_gapi.encryption = Google::Apis::StorageV1::Bucket::Encryption.new default_kms_key_name: kms_key |
214 | 207 |
|
215 | | - mock.expect :update_bucket, returned_bucket_gapi do |name, patch_obj, **kwargs| |
216 | | - cm_config = patch_obj.encryption.customer_managed_encryption_enforcement_config |
217 | | - cs_config = patch_obj.encryption.customer_supplied_encryption_enforcement_config |
218 | | - gm_config = patch_obj.encryption.google_managed_encryption_enforcement_config |
219 | | - |
220 | | - name == bucket_name && |
221 | | - (cm_config == {} || cm_config.nil?) && |
222 | | - (cs_config == {} || cs_config.nil?) && |
223 | | - (gm_config == {} || gm_config.nil?) && |
224 | | - patch_obj.encryption.default_kms_key_name == kms_key |
225 | | - end |
| 208 | + mock.expect(:update_bucket, returned_bucket_gapi) { |name, patch_obj, **| name == bucket_name && patch_obj.encryption.default_kms_key_name == kms_key } |
226 | 209 |
|
227 | 210 | bucket_with_configs_and_key.service.mocked_service = mock |
228 | 211 |
|
|
0 commit comments