docstr: Fixture to give a mock `internal_api.Api` object, with properly-functioning sync/async upload methods.
  
  Also adds an `upload_method` field, which points to either `upload_file_retry`
  or `upload_file_retry_async`, depending on which `store_file_mode` is being used.
  This is useful for making assertions about what files `store_file` uploaded,
  without needing to know whether it used the sync or async impl.
docstr_tok: ["Fixture","to","give","a","mock","`","internal_api.Api","`","object",",","with","properly-functioning","sync\/async","upload","methods",".","Also","adds","an","`","upload_method","`","field",",","which","points","to","either","`","upload_file_retry","`","or","`","upload_file_retry_async","`",",","depending","on","which","`","store_file_mode","`","is","being","used",".","This","is","useful","for","making","assertions","about","what","files","`","store_file","`","uploaded",",","without","needing","to","know","whether","it","used","the","sync","or","async","impl","."]
code: def api(self, store_file_mode):
      """Fixture to give a mock `internal_api.Api` object, with properly-functioning sync/async upload methods.
  
      Also adds an `upload_method` field, which points to either `upload_file_retry`
      or `upload_file_retry_async`, depending on which `store_file_mode` is being used.
      This is useful for making assertions about what files `store_file` uploaded,
      without needing to know whether it used the sync or async impl.
      """
      upload_file_retry = Mock()
      upload_file_retry_async = Mock(wraps=asyncify(Mock()))
      upload_multipart_file_chunk_retry = Mock()
      complete_multipart_upload_artifact = Mock()
      upload_method = {
          "sync": upload_file_retry,
          "async": upload_file_retry_async,
      }[store_file_mode]
  
      return Mock(
          upload_file_retry=upload_file_retry,
          upload_file_retry_async=upload_file_retry_async,
          upload_method=upload_method,
          upload_multipart_file_chunk_retry=upload_multipart_file_chunk_retry,
          complete_multipart_upload_artifact=complete_multipart_upload_artifact,
      )
  
imports: import asyncio
  import functools
  import queue
  import shutil
  import unittest.mock
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Mapping, Optional
  from unittest.mock import Mock
  import pytest
  import requests
  from wandb.filesync.step_prepare import ResponsePrepare, StepPrepare
  from wandb.sdk.artifacts.artifact import Artifact
  from wandb.sdk.artifacts.artifact_file_cache import ArtifactFileCache
  from wandb.sdk.artifacts.artifact_instance_cache import artifact_instance_cache
  from wandb.sdk.artifacts.artifact_manifest_entry import ArtifactManifestEntry
  from wandb.sdk.artifacts.exceptions import ArtifactNotLoggedError
  from wandb.sdk.artifacts.storage_policies.wandb_storage_policy import WandbStoragePolicy
label_desc: Use image node_id 6 for calling the TestStoreFile obj's underlying member method code with example usage: obj.api(store_file_mode) and returns: Mock