code: def test_import_excel(mock_event_logger):
      if utils.backend() == "hive":
          pytest.skip("Hive doesn't excel upload.")
  
      schema = utils.get_example_default_schema()
      full_table_name = (
          f"{schema}.{EXCEL_UPLOAD_TABLE}"
          if schema
          else EXCEL_UPLOAD_TABLE
      )
      test_db = get_upload_db()
  
      success_msg = f"Excel file {escaped_double_quotes(EXCEL_FILENAME)} uploaded to table {escaped_double_quotes(full_table_name)}"
  
      # initial upload with fail mode
      resp = upload_excel(EXCEL_FILENAME, EXCEL_UPLOAD_TABLE)
      assert success_msg in resp
      mock_event_logger.assert_called_with(
          action="successful_excel_upload",
          database=test_db.name,
          schema=schema,
          table=EXCEL_UPLOAD_TABLE,
      )
  
      # ensure user is assigned as an owner
      table = SupersetTestCase.get_table(name=EXCEL_UPLOAD_TABLE)
      assert security_manager.find_user("admin") in table.owners
  
      # upload again with fail mode; should fail
      fail_msg = f"Unable to upload Excel file {escaped_double_quotes(EXCEL_FILENAME)} to table {escaped_double_quotes(EXCEL_UPLOAD_TABLE)}"
      resp = upload_excel(EXCEL_FILENAME, EXCEL_UPLOAD_TABLE)
      assert fail_msg in resp
  
      if utils.backend() != "hive":
          # upload again with append mode
          resp = upload_excel(
              EXCEL_FILENAME,
              EXCEL_UPLOAD_TABLE,
              extra={"if_exists": "append"},
          )
          assert success_msg in resp
  
      # upload again with replace mode
      resp = upload_excel(
          EXCEL_FILENAME,
          EXCEL_UPLOAD_TABLE,
          extra={"if_exists": "replace"},
      )
      assert success_msg in resp
      mock_event_logger.assert_called_with(
          action="successful_excel_upload",
          database=test_db.name,
          schema=schema,
          table=EXCEL_UPLOAD_TABLE,
      )
  
      with test_db.get_sqla_engine_with_context() as engine:
          data = engine.execute(
              f"SELECT * from {EXCEL_UPLOAD_TABLE} ORDER BY b"
          ).fetchall()
          assert data == [(0, "john", 1), (1, "paul", 2)]
  
imports: import json
  import logging
  import os
  import shutil
  from typing import Optional, Union
  from unittest import mock
  import pandas
  import pytest
  import superset.utils.database
  from superset.sql_parse import Table
  from tests.integration_tests.conftest import ADMIN_SCHEMA_NAME
  from superset import db
  from superset import security_manager
  from superset.models.core import Database
  from superset.utils import core
  from tests.integration_tests.test_app import app, login
  from tests.integration_tests.base_tests import get_resp, SupersetTestCase
label_desc: Use image node_id 17 for calling a global function with example usage: test_import_excel(mock_event_logger) without return types