code: def test_import_database(
      mocker: MockFixture, session: Session
  ) -> None:
      """
      Test importing a database.
      """
      from superset import security_manager
      from superset.commands.database.importers.v1.utils import (
          import_database,
      )
      from superset.models.core import Database
      from tests.integration_tests.fixtures.importexport import (
          database_config,
      )
  
      mocker.patch.object(
          security_manager, "can_access", return_value=True
      )
  
      engine = session.get_bind()
      Database.metadata.create_all(engine)  # pylint: disable=no-member
  
      config = copy.deepcopy(database_config)
      database = import_database(session, config)
      assert database.database_name == "imported_database"
      assert database.sqlalchemy_uri == "someengine://user:pass@host1"
      assert database.cache_timeout is None
      assert database.expose_in_sqllab is True
      assert database.allow_run_async is False
      assert database.allow_ctas is True
      assert database.allow_cvas is True
      assert database.allow_dml is True
      assert database.allow_file_upload is True
      assert database.extra == "{}"
      assert database.uuid == "b8a1ccd3-779d-4ab7-8ad8-9ab119d7fe89"
      assert database.is_managed_externally is False
      assert database.external_url is None
  
      # ``allow_dml`` was initially not exported; the import should work if the field is
      # missing
      config = copy.deepcopy(database_config)
      del config["allow_dml"]
      session.delete(database)
      session.flush()
      database = import_database(session, config)
      assert database.allow_dml is False
  
file_path: superset/tests/unit_tests/databases/commands/importers/v1/import_test.py
imports: import copy
  import json
  import pytest
  from pytest_mock import MockFixture
  from sqlalchemy.orm.session import Session
  from superset.commands.exceptions import ImportFailedError
label_desc: Use image node_id 1 for calling a global function with example usage: test_import_database(mocker, session) without return types