code: def test_list_artifacts_when_ftp_nlst_returns_absolute_paths(
      ftp_mock,
  ):
      artifact_root_path = "/experiment_id/run_id/"
      repo = FTPArtifactRepository(
          "ftp://test_ftp" + artifact_root_path
      )
  
      repo.get_ftp_client = MagicMock()
      call_mock = MagicMock(return_value=ftp_mock)
      repo.get_ftp_client.return_value = MagicMock(__enter__=call_mock)
  
      # mocked file structure
      #  |- file
      #  |- model
      #     |- model.pb
  
      file_path = "file"
      dir_path = "model"
      file_size = 678
      ftp_mock.cwd = MagicMock(
          side_effect=[None, ftplib.error_perm, None]
      )
      ftp_mock.nlst = MagicMock(
          return_value=[
              posixpath.join(artifact_root_path, file_path),
              posixpath.join(artifact_root_path, dir_path),
          ]
      )
  
      ftp_mock.size = MagicMock(return_value=file_size)
  
      artifacts = repo.list_artifacts(path=None)
  
      ftp_mock.nlst.assert_called_once_with(artifact_root_path)
      ftp_mock.size.assert_called_once_with(
          artifact_root_path + file_path
      )
  
      assert len(artifacts) == 2
      assert artifacts[0].path == file_path
      assert artifacts[0].is_dir is False
      assert artifacts[0].file_size == file_size
      assert artifacts[1].path == dir_path
      assert artifacts[1].is_dir is True
      assert artifacts[1].file_size is None
  
imports: import ftplib
  import posixpath
  from ftplib import FTP
  from unittest.mock import MagicMock
  import pytest
  from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository
  from mlflow.store.artifact.ftp_artifact_repo import FTPArtifactRepository
label_desc: Use image node_id 6 for calling a global function with example usage: test_list_artifacts_when_ftp_nlst_returns_absolute_paths(ftp_mock) without return types