class_docstr: Testing export import functionality for dashboards
class_docstr_tok: ["Testing","export","import","functionality","for","dashboards"]
code: def create_slice(
      self,
      name,
      ds_id=None,
      id=None,
      db_name="examples",
      table_name="wb_health_population",
      schema=None,
  ):
      params = {
          "num_period_compare": "10",
          "remote_id": id,
          "datasource_name": table_name,
          "database_name": db_name,
          "schema": schema,
          # Test for trailing commas
          "metrics": [
              "sum__signup_attempt_email",
              "sum__signup_attempt_facebook",
          ],
      }
  
      if table_name and not ds_id:
          table = self.get_table(schema=schema, name=table_name)
          if table:
              ds_id = table.id
  
      return Slice(
          slice_name=name,
          datasource_type=DatasourceType.TABLE,
          viz_type="bubble",
          params=json.dumps(params),
          datasource_id=ds_id,
          id=id,
      )
  
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 1 for calling the TestImportExport obj's underlying member method code with example usage: obj.create_slice(name, ds_id, id, db_name, table_name, schema) and returns: Slice