Skip to content

Commit

Permalink
SRV-948 fix - mocking security manager
Browse files Browse the repository at this point in the history
  • Loading branch information
nyohasstium committed Jan 6, 2025
1 parent 33b69dc commit 26e9f9a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/integration_tests/query_context_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
import re
import time
from typing import Any
from unittest import mock
from unittest.mock import Mock, patch

import numpy as np
import pandas as pd
import pytest
from pandas import DateOffset

from superset import app, db
from superset import app, db, security_manager
from superset.charts.schemas import ChartDataQueryContextSchema
from superset.common.chart_data import ChartDataResultFormat, ChartDataResultType
from superset.common.query_context import QueryContext
Expand Down Expand Up @@ -66,6 +67,11 @@ def get_sql_text(payload: dict[str, Any]) -> str:


class TestQueryContext(SupersetTestCase):

@mock.patch("superset.security.manager.g")
def setUp(self, mock_g):
mock_g.user = security_manager.find_user("admin")

@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_schema_deserialization(self):
"""
Expand Down

0 comments on commit 26e9f9a

Please sign in to comment.