def METHOD_NAME(
    mocker: MockFixture,
    session: Session,
) -> None:
    """
    Test importing a chart when a user doesn't have permissions to create.
    """
    from superset import security_manager
    from superset.charts.commands.importers.v1.utils import import_chart
    from superset.connectors.sqla.models import SqlaTable
    from superset.models.core import Database
    from superset.models.slice import Slice
    from tests.integration_tests.fixtures.importexport import chart_config
    mocker.patch.object(security_manager, "can_access", return_value=False)
    engine = session.get_bind()
    Slice.metadata.create_all(engine)  # pylint: disable=no-member
    config = copy.deepcopy(chart_config)
    config["datasource_id"] = 1
    config["datasource_type"] = "table"
    with pytest.raises(ImportFailedError) as excinfo:
        import_chart(session, config)
    assert (
        str(excinfo.value)
        == "Chart doesn't exist and user doesn't have permission to create charts"
    )