MockStorageClient#
- class safir.testing.gcs.MockStorageClient(expected_expiration=None, path=None, bucket_name=None)#
Bases:
Mock
Mock version of
google.cloud.storage.Client
.Only supports
bucket
, and the resulting object only supports theblob
method. The resulting blob only supports thegenerate_signed_url
method.- Parameters:
expected_expiration (
timedelta
|None
, default:None
) – The expiration that should be requested in a call togenerate_signed_url
on an underlying blob. A non-matching call will produce an assertion failure.path (
Path
|None
, default:None
) – Root of the file path for blobs, if given. If not given, a simpler mock blob will be used that only supportsgenerate_signed_url
.bucket_name (
str
|None
, default:None
) – If set, all requests for a bucket with a name other than the one provided will produce assertion failures.
Methods Summary
bucket
(bucket_name)Retrieve a mock bucket.
Methods Documentation