class_docstr: Testing export import functionality for dashboards
class_docstr_tok: ["Testing","export","import","functionality","for","dashboards"]
code: def test_import_dashboard_1_slice(self):
      slc = self.create_slice(
          "health_slc", id=10006, schema=get_example_default_schema()
      )
      dash_with_1_slice = self.create_dashboard(
          "dash_with_1_slice", slcs=[slc], id=10002
      )
      dash_with_1_slice.position_json = """
              {{"DASHBOARD_VERSION_KEY": "v2",
                "DASHBOARD_CHART_TYPE-{0}": {{
                  "type": "CHART",
                  "id": {0},
                  "children": [],
                  "meta": {{
                    "width": 4,
                    "height": 50,
                    "chartId": {0}
                  }}
                }}
              }}
          """.format(
          slc.id
      )
      imported_dash_id = import_dashboard(
          dash_with_1_slice, import_time=1990
      )
      imported_dash = self.get_dash(imported_dash_id)
  
      expected_dash = self.create_dashboard(
          "dash_with_1_slice", slcs=[slc], id=10002
      )
      make_transient(expected_dash)
      self.assert_dash_equals(
          expected_dash,
          imported_dash,
          check_position=False,
          check_slugs=False,
      )
      self.assertEqual(
          {"remote_id": 10002, "import_time": 1990},
          json.loads(imported_dash.json_metadata),
      )
  
      expected_position = dash_with_1_slice.position
      # new slice id (auto-incremental) assigned on insert
      # id from json is used only for updating position with new id
      meta = expected_position["DASHBOARD_CHART_TYPE-10006"]["meta"]
      meta["chartId"] = imported_dash.slices[0].id
      self.assertEqual(expected_position, imported_dash.position)
  
imports: import json
  import unittest
  from tests.integration_tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices, load_birth_names_data
  import pytest
  from flask import g
  from sqlalchemy.orm.session import make_transient
  from tests.integration_tests.fixtures.energy_dashboard import load_energy_table_with_slice, load_energy_table_data
  from tests.integration_tests.test_app import app
  from superset.commands.dashboard.importers.v0 import decode_dashboards
  from superset import db, security_manager
  from superset.connectors.sqla.models import SqlaTable, SqlMetric, TableColumn
  from superset.commands.dashboard.importers.v0 import import_chart, import_dashboard
  from superset.commands.dataset.importers.v0 import import_dataset
  from superset.models.dashboard import Dashboard
  from superset.models.slice import Slice
  from superset.utils.core import DatasourceType, get_example_default_schema
  from superset.utils.database import get_example_database
  from tests.integration_tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices, load_world_bank_data
  from .base_tests import SupersetTestCase
label_desc: Use image node_id 18 for calling the TestImportExport obj's underlying member method code with example usage: obj.test_import_dashboard_1_slice() without return types