class_docstr: Testing export import functionality for dashboards
class_docstr_tok: ["Testing","export","import","functionality","for","dashboards"]
code: def test_import_new_dashboard_slice_reset_ownership(self):
      admin_user = security_manager.find_user(username="admin")
      self.assertTrue(admin_user)
      gamma_user = security_manager.find_user(username="gamma")
      self.assertTrue(gamma_user)
      g.user = gamma_user
  
      dash_with_1_slice = self._create_dashboard_for_import(id_=10200)
      # set another user as an owner of importing dashboard
      dash_with_1_slice.created_by = admin_user
      dash_with_1_slice.changed_by = admin_user
      dash_with_1_slice.owners = [admin_user]
  
      imported_dash_id = import_dashboard(dash_with_1_slice)
      imported_dash = self.get_dash(imported_dash_id)
      self.assertEqual(imported_dash.created_by, gamma_user)
      self.assertEqual(imported_dash.changed_by, gamma_user)
      self.assertEqual(imported_dash.owners, [gamma_user])
  
      imported_slc = imported_dash.slices[0]
      self.assertEqual(imported_slc.created_by, gamma_user)
      self.assertEqual(imported_slc.changed_by, gamma_user)
      self.assertEqual(imported_slc.owners, [gamma_user])
  
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 21 for calling the TestImportExport obj's underlying member method code with example usage: obj.test_import_new_dashboard_slice_reset_ownership() without return types