docstr: Test that we can import a dataset
docstr_tok: ["Test","that","we","can","import","a","dataset"]
code: def test_import_v1_dataset(self, sm_g, utils_g):
      """Test that we can import a dataset"""
      admin = sm_g.user = utils_g.user = security_manager.find_user(
          "admin"
      )
      contents = {
          "metadata.yaml": yaml.safe_dump(dataset_metadata_config),
          "databases/imported_database.yaml": yaml.safe_dump(
              database_config
          ),
          "datasets/imported_dataset.yaml": yaml.safe_dump(
              dataset_config
          ),
      }
      command = v1.ImportDatasetsCommand(contents)
      command.run()
  
      dataset = (
          db.session.query(SqlaTable)
          .filter_by(uuid=dataset_config["uuid"])
          .one()
      )
      assert dataset.table_name == "imported_dataset"
      assert dataset.main_dttm_col is None
      assert (
          dataset.description == "This is a dataset that was exported"
      )
      assert dataset.default_endpoint == ""
      assert dataset.offset == 66
      assert dataset.cache_timeout == 55
      assert dataset.schema == ""
      assert dataset.sql == ""
      assert dataset.params is None
      assert dataset.template_params == "{}"
      assert dataset.filter_select_enabled
      assert dataset.fetch_values_predicate is None
      assert (
          dataset.extra
          == '{"certification": {"certified_by": "Data Platform Team", "details": "This table is the source of truth."}, "warning_markdown": "This is a warning."}'
      )
  
      # user should be included as one of the owners
      assert dataset.owners == [admin]
  
      # database is also imported
      assert (
          str(dataset.database.uuid)
          == "b8a1ccd3-779d-4ab7-8ad8-9ab119d7fe89"
      )
  
      assert len(dataset.metrics) == 1
      metric = dataset.metrics[0]
      assert metric.metric_name == "count"
      assert metric.verbose_name == ""
      assert metric.metric_type is None
      assert metric.expression == "count(1)"
      assert metric.description is None
      assert metric.d3format is None
      assert metric.currency is None
      assert metric.extra == "{}"
      assert metric.warning_text is None
  
      assert len(dataset.columns) == 1
      column = dataset.columns[0]
      assert column.column_name == "cnt"
      assert column.verbose_name == "Count of something"
      assert not column.is_dttm
      assert column.is_active  # imported columns are set to active
      assert column.type == "NUMBER"
      assert not column.groupby
      assert column.filterable
      assert column.expression == ""
      assert column.description is None
      assert column.python_date_format is None
  
      db.session.delete(dataset)
      db.session.delete(dataset.database)
      db.session.commit()
  
imports: from operator import itemgetter
  from typing import Any
  from unittest.mock import patch
  import pytest
  import yaml
  from sqlalchemy.exc import SQLAlchemyError
  from superset import db, security_manager
  from superset.commands.database.importers.v1 import ImportDatabasesCommand
  from superset.commands.dataset.create import CreateDatasetCommand
  from superset.commands.dataset.exceptions import DatasetInvalidError, DatasetNotFoundError, WarmUpCacheTableNotFoundError
  from superset.commands.dataset.export import ExportDatasetsCommand
  from superset.commands.dataset.importers import v0, v1
  from superset.commands.dataset.warm_up_cache import DatasetWarmUpCacheCommand
  from superset.commands.exceptions import CommandInvalidError
  from superset.commands.importers.exceptions import IncorrectVersionError
  from superset.connectors.sqla.models import SqlaTable
  from superset.models.core import Database
  from superset.models.slice import Slice
  from superset.utils.core import get_example_default_schema, override_user
  from superset.utils.database import get_example_database
  from tests.integration_tests.base_tests import SupersetTestCase
  from tests.integration_tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices, load_birth_names_data
  from tests.integration_tests.fixtures.energy_dashboard import load_energy_table_data, load_energy_table_with_slice
  from tests.integration_tests.fixtures.importexport import database_config, database_metadata_config, dataset_cli_export, dataset_config, dataset_metadata_config, dataset_ui_export
  from tests.integration_tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices, load_world_bank_data
label_desc: Use image node_id 3 for calling the TestImportDatasetsCommand obj's underlying member method code with example usage: obj.test_import_v1_dataset(sm_g, utils_g) without return types