Module Expr Str ImportFrom alias ImportFrom alias identifier ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults Str body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str TupleLoad AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Return Call NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr keyword NameLoad keyword Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad Assign AttributeStore NameLoad attr Dict decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str body Return Call AttributeLoad NameLoad attr Call NameLoad Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str body Expr Str Assign NameStore AttributeLoad NameLoad attr If BoolOpAnd AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr CompareIn AttributeLoad NameLoad attr AttributeLoad NameLoad attr body If CompareIn Str SubscriptLoad AttributeLoad NameLoad attr Index NameLoad body Assign AttributeStore NameLoad attr BinOpAdd AttributeLoad AttributeLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str attr attr Num If CompareNotIn Str SubscriptLoad AttributeLoad NameLoad attr Index NameLoad body Assign SubscriptStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str ListLoad Expr Call AttributeLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str attr SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str orelse If BoolOpAnd CompareIn Str SubscriptLoad AttributeLoad NameLoad attr Index NameLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str body Assign AttributeStore NameLoad attr BinOpAdd AttributeLoad AttributeLoad SubscriptLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str Index Num attr attr Num orelse Assign AttributeStore NameLoad attr Num Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad Dict Assign NameStore Call NameLoad NameLoad keyword NameLoad Assign SubscriptStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str NameLoad Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults Str body Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareIn NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad BinOpMod Str NameLoad keyword Num Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If CompareIn NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad BinOpMod Str NameLoad keyword Num Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad Call NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Str body Expr Str If CompareNotIn NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str body Expr Str Assert AttributeLoad NameLoad attr Str Assert AttributeLoad NameLoad attr Str If CompareNotIn AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return AttributeLoad Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr attr NameLoad keyword NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad body Expr Str If NameLoad body Assign NameStore Call NameLoad NameLoad If CompareIn NameLoad AttributeLoad NameLoad attr body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad If BoolOpAnd CompareIn NameLoad AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index NameLoad body If NameLoad body If CompareIn Str SubscriptLoad AttributeLoad NameLoad attr Index NameLoad body For NameStore SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str body If CompareEq AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Return AttributeLoad NameLoad attr If CompareIn Str SubscriptLoad AttributeLoad NameLoad attr Index NameLoad body If CompareEq AttributeLoad AttributeLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str attr attr NameLoad body Return AttributeLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str attr orelse If CompareIn Str SubscriptLoad AttributeLoad NameLoad attr Index NameLoad body Return AttributeLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Str attr Raise Call NameLoad Num AttributeLoad NameLoad attr NameLoad NameLoad Raise Call NameLoad Num AttributeLoad NameLoad attr NameLoad decorator_list decorator_list
N/A N/A Implements a simple mock gsutil Cloud API for unit testing.

gsutil 4 was primarily unit-tested using boto/gsutil 3's mock storage_uri class,
since it was possible that changing out the underlying mocks would have had
subtly different behavior and increased the risk of breaking back-compat.

Most unit and integration tests in gsutil 4 still set up the test objects with
storage_uris and boto, and the unit tests interact with test objects via
storage uris and boto.

This testing approach ties our tests heavily to boto; extending the
boto mocks is difficult because it requires checking into boto. This also
makes the unit test coverage boto-specific in several cases.

MockCloudApi was initially written to cover some parallel composite upload
cases that the boto mocks couldn't handle. It is not yet a full implementation.
Eventually, we can move to full a mock Cloud API implementation. However, we
need to ensure we don't lose boto coverage from mock storage_uri.
 gslib.cloud_api ServiceException gslib.third_party.storage_apitools storage_v1_messages apitools_messages gslib.translation_helper CreateBucketNotFoundException gslib.translation_helper CreateObjectNotFoundException MockObject N/A object N/A N/A Defines a mock cloud storage provider object. __init__ N/A N/A self root_object contents N/A N/A N/A N/A self root_object root_object N/A N/A self contents contents N/A __str__ N/A N/A self N/A N/A N/A N/A %s/%s#%s N/A N/A N/A self root_object bucket N/A N/A self root_object name N/A N/A self root_object generation N/A __repr__ N/A N/A self N/A N/A N/A N/A str self N/A N/A MockBucket N/A object N/A N/A Defines a mock cloud storage provider bucket. __init__ N/A N/A self bucket_name versioned N/A False N/A N/A N/A self root_object N/A N/A apitools_messages Bucket name bucket_name versioning N/A N/A N/A apitools_messages Bucket VersioningValue enabled versioned N/A N/A self objects N/A N/A CreateObject N/A N/A self object_name contents N/A N/A N/A N/A N/A self CreateObjectWithMetadata N/A MockObject N/A N/A apitools_messages Object name object_name contents contents N/A CreateObjectWithMetadata N/A N/A self apitools_object contents N/A N/A N/A Creates an object in the bucket according to the input metadata.

    This will create a new object version (ignoring the generation specified
    in the input object).

    Args:
      apitools_object: apitools Object.
      contents: optional object contents.

    Returns:
      apitools Object representing created object.
     N/A object_name N/A apitools_object name N/A N/A N/A N/A self root_object versioning N/A N/A N/A self root_object versioning enabled N/A N/A apitools_object name N/A self objects N/A N/A N/A live N/A N/A self objects N/A object_name N/A N/A N/A apitools_object generation N/A N/A N/A N/A N/A N/A self objects N/A object_name N/A live root_object generation 1 N/A N/A versioned N/A N/A self objects N/A object_name N/A N/A N/A N/A N/A self objects N/A object_name N/A versioned N/A N/A N/A N/A N/A N/A N/A self objects N/A object_name N/A versioned append N/A N/A N/A self objects N/A object_name N/A live N/A N/A N/A N/A versioned N/A N/A self objects N/A object_name N/A N/A N/A self objects N/A object_name N/A versioned N/A N/A N/A apitools_object generation N/A N/A N/A N/A N/A N/A N/A self objects N/A object_name N/A versioned N/A -1 root_object generation 1 N/A N/A N/A apitools_object generation 1 N/A N/A N/A self objects N/A object_name N/A N/A new_object N/A MockObject apitools_object contents contents N/A N/A N/A N/A self objects N/A object_name N/A live new_object N/A new_object N/A N/A MockCloudApi N/A object N/A N/A Simple mock service for buckets/objects that implements Cloud API.

  Also includes some setup functions for tests.
   __init__ N/A N/A self provider N/A gs N/A N/A N/A self buckets N/A N/A N/A self provider provider N/A MockCreateBucket N/A N/A self bucket_name N/A N/A N/A Creates a simple bucket without exercising the API directly. N/A N/A bucket_name N/A self buckets N/A N/A N/A ServiceException N/A Bucket %s already exists. bucket_name status 409 N/A N/A N/A self buckets N/A bucket_name N/A MockBucket bucket_name N/A MockCreateVersionedBucket N/A N/A self bucket_name N/A N/A N/A Creates a simple bucket without exercising the API directly. N/A N/A bucket_name N/A self buckets N/A N/A N/A ServiceException N/A Bucket %s already exists. bucket_name status 409 N/A N/A N/A self buckets N/A bucket_name N/A MockBucket bucket_name versioned True N/A MockCreateObject N/A N/A self bucket_name object_name contents N/A N/A N/A Creates an object without exercising the API directly. N/A N/A bucket_name N/A self buckets N/A N/A N/A N/A self MockCreateBucket bucket_name N/A N/A N/A N/A N/A self buckets N/A bucket_name CreateObject object_name contents contents N/A MockCreateObjectWithMetadata N/A N/A self apitools_object contents N/A N/A N/A Creates an object without exercising the API directly. N/A N/A apitools_object bucket No bucket specified for mock object N/A N/A apitools_object name No object name specified for mock object N/A N/A N/A apitools_object bucket N/A self buckets N/A N/A N/A N/A self MockCreateBucket N/A apitools_object bucket N/A N/A N/A N/A N/A N/A self buckets N/A N/A apitools_object bucket CreateObjectWithMetadata apitools_object contents contents root_object N/A GetObjectMetadata N/A N/A self bucket_name object_name generation provider fields N/A None None None N/A N/A See CloudApi class for function doc strings. N/A generation N/A N/A generation N/A long generation N/A N/A bucket_name N/A self buckets N/A N/A bucket N/A N/A self buckets N/A bucket_name N/A N/A N/A object_name N/A bucket objects N/A N/A bucket objects N/A object_name N/A N/A generation N/A N/A N/A versioned N/A N/A bucket objects N/A object_name N/A N/A obj N/A N/A N/A bucket objects N/A object_name N/A versioned N/A N/A N/A N/A N/A obj root_object generation generation N/A N/A N/A obj root_object N/A N/A live N/A N/A bucket objects N/A object_name N/A N/A N/A N/A N/A N/A N/A N/A bucket objects N/A object_name N/A live root_object generation generation N/A N/A N/A N/A N/A N/A bucket objects N/A object_name N/A live root_object N/A N/A N/A live N/A N/A bucket objects N/A object_name N/A N/A N/A N/A N/A N/A bucket objects N/A object_name N/A live root_object N/A N/A CreateObjectNotFoundException 404 N/A self provider bucket_name object_name N/A N/A CreateBucketNotFoundException 404 N/A self provider bucket_name N/A N/A