code: def test_deny_access():
      downloader = S3Downloader(authenticator=S3Authenticator())
  
      def deny_access(*args, **kwargs):
          raise AccessDeniedError
  
      with assert_raises(DownloadError):
          with patch.object(downloader, "_download", deny_access):
              downloader.download("doesn't matter")
  
imports: import os
  from unittest.mock import patch
  import pytest
  from ...downloaders.base import DownloadError
  from ...support import path
  from ...support.exceptions import AccessDeniedError
  from ...tests.utils_pytest import SkipTest, assert_equal, assert_raises, integration, skip_if_no_module, skip_if_no_network, swallow_outputs, turtle, use_cassette, with_tempfile, with_testsui
  from ...utils import md5sum
  from ..providers import Providers
  from ..s3 import S3Authenticator, S3Downloader
  from .test_http import check_download_external_url
  from .utils import get_test_providers
label_desc: Use image node_id 5 for calling a global function with example usage: test_deny_access() without return types