class_docstr: Implements shared tests for owners related field
class_docstr_tok: ["Implements","shared","tests","for","owners","related","field"]
docstr: API: Test get related owners with extra related query filters
docstr_tok: ["API",":","Test","get","related","owners","with","extra","related","query","filters"]
code: def test_get_related_owners_with_extra_filters(self):
      """
      API: Test get related owners with extra related query filters
      """
      self.login(username="admin")
  
      def _base_filter(query):
          return query.filter_by(username="alpha")
  
      with patch.dict(
          "superset.views.filters.current_app.config",
          {"EXTRA_RELATED_QUERY_FILTERS": {"user": _base_filter}},
      ):
          uri = f"api/v1/{self.resource_name}/related/owners"
          rv = self.client.get(uri)
          assert rv.status_code == 200
          response = json.loads(rv.data.decode("utf-8"))
          response_users = [
              result["text"] for result in response["result"]
          ]
          assert response_users == ["alpha user"]
  
imports: import json
  from unittest.mock import patch
  from tests.integration_tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices, load_world_bank_data
  import pytest
  from flask_appbuilder.models.sqla.interface import SQLAInterface
  import prison
  import tests.integration_tests.test_app
  from superset import db, security_manager
  from superset.extensions import appbuilder
  from superset.models.dashboard import Dashboard
  from superset.views.base_api import BaseSupersetModelRestApi, requires_json
  from .base_tests import SupersetTestCase
  from .conftest import with_config
label_desc: Use image node_id 2 for calling the ApiOwnersTestCaseMixin obj's underlying member method code with example usage: obj.test_get_related_owners_with_extra_filters() and returns: query