docstr: Test that a dataset can be imported multiple times
docstr_tok: ["Test","that","a","dataset","can","be","imported","multiple","times"]
code: def test_import_v1_dataset_multiple(self, mock_g):
      """Test that a dataset can be imported multiple times"""
      mock_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, overwrite=True)
      command.run()
      command.run()
      dataset = (
          db.session.query(SqlaTable)
          .filter_by(uuid=dataset_config["uuid"])
          .one()
      )
      assert dataset.table_name == "imported_dataset"
  
      # test that columns and metrics sync, ie, old ones not the import
      # are removed
      new_config = dataset_config.copy()
      new_config["metrics"][0]["metric_name"] = "count2"
      new_config["columns"][0]["column_name"] = "cnt2"
      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(new_config),
      }
      command = v1.ImportDatasetsCommand(contents, overwrite=True)
      command.run()
      dataset = (
          db.session.query(SqlaTable)
          .filter_by(uuid=dataset_config["uuid"])
          .one()
      )
      assert len(dataset.metrics) == 1
      assert dataset.metrics[0].metric_name == "count2"
      assert len(dataset.columns) == 1
      assert dataset.columns[0].column_name == "cnt2"
  
      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 4 for calling the TestImportDatasetsCommand obj's underlying member method code with example usage: obj.test_import_v1_dataset_multiple(mock_g) without return types