code: def _perform_mng_test(mng):
      # test pushing a file asset
      data_path = os.path.join(test_path, "testdata", "some_data.json")
      mng.storage_provider.push(
          data_path, "category-test/some-data.ext", "1.0"
      )
      # check metadata
      meta = mng.storage_provider.get_asset_meta(
          "category-test/some-data.ext", "1.0"
      )
      assert not meta["is_directory"]
      # fetch asset
      d = mng.fetch_asset(
          "category-test/some-data.ext:1.0", return_info=True
      )
      fetched_path = d["path"]
      assert fetched_path.endswith(
          os.path.join("category-test", "some-data.ext", "1.0")
      )
  
      # check that it was not fetched from cache
      assert not d["from_cache"]
      # and meta is present
      assert d["meta"]
      # compare
      assert filecmp.cmp(fetched_path, data_path)
  
      # test pushing a directory asset
      data_path = os.path.join(
          test_path, "testdata", "some_data_folder"
      )
      mng.storage_provider.push(
          data_path, "category-test/some-data-2", "1.0"
      )
  
      # check metadata
      meta = mng.storage_provider.get_asset_meta(
          "category-test/some-data-2", "1.0"
      )
      assert meta["is_directory"]
  
      # fetch asset
      d = mng.fetch_asset(
          "category-test/some-data-2:1.0", return_info=True
      )
      fetched_path = d["path"]
      assert fetched_path.endswith(
          os.path.join("category-test", "some-data-2", "1.0")
      )
  
      # check that it was not fetched from cache
      assert not d["from_cache"]
      # and meta is present
      assert d["meta"]
      # compare
      assert not filecmp.cmpfiles(
          data_path,
          fetched_path,
          ["some_data_in_folder.json", "some_data_in_folder_2.json"],
          shallow=False,
      )[1]
  
      # fetch asset again
      d = mng.fetch_asset(
          "category-test/some-data.ext:1.0", return_info=True
      )
      # check that it was fetched from cache
      assert d["from_cache"]
  
      # fetch asset again
      d = mng.fetch_asset(
          "category-test/some-data-2:1.0", return_info=True
      )
      # check that it was fetched from cache
      assert d["from_cache"]
  
      # attempt to overwrite the asset
      with pytest.raises(errors.AssetAlreadyExistsError):
          mng.storage_provider.push(
              os.path.join(data_path, "some_data_in_folder.json"),
              "category-test/some-data.ext",
              "1.0",
          )
  
      # fetch asset again
      d = mng.fetch_asset(
          "category-test/some-data.ext:1.0", return_info=True
      )
      assert d["from_cache"]
  
file_path: modelkit/tests/assets/test_assetsmanager.py
imports: import filecmp
  import os
  import tempfile
  import pytest
  import modelkit.assets.cli
  from modelkit.assets import errors
  from modelkit.assets.manager import AssetsManager, _success_file_path
  from modelkit.assets.remote import StorageProvider
  from tests.conftest import skip_unless
label_desc: Use image node_id 1 for calling a global function with example usage: _perform_mng_test(mng) without return types