class_docstr: Test class for TableauOperator
docstr: Test execute datasources blocking
docstr_tok: ["Test","execute","datasources","blocking"]
code: def test_execute_datasources_blocking(self, mock_tableau_hook):
      """
      Test execute datasources blocking
      """
      mock_signed_in = [False]
  
      def mock_hook_enter():
          mock_signed_in[0] = True
          return mock_tableau_hook
  
      def mock_hook_exit(exc_type, exc_val, exc_tb):
          mock_signed_in[0] = False
  
      def mock_wait_for_state(job_id, target_state, check_interval):
          if not mock_signed_in[0]:
              raise Exception("Not signed in")
  
          return True
  
      mock_tableau_hook.return_value.__enter__ = Mock(
          side_effect=mock_hook_enter
      )
      mock_tableau_hook.return_value.__exit__ = Mock(
          side_effect=mock_hook_exit
      )
      mock_tableau_hook.wait_for_state = Mock(
          side_effect=mock_wait_for_state
      )
  
      mock_tableau_hook.get_all = Mock(
          return_value=self.mock_datasources
      )
      operator = TableauOperator(
          find="ds_2", resource="datasources", **self.kwargs
      )
  
      job_id = operator.execute(context={})
  
      mock_tableau_hook.server.datasources.refresh.assert_called_once_with(
          2
      )
      assert (
          mock_tableau_hook.server.datasources.refresh.return_value.id
          == job_id
      )
      mock_tableau_hook.wait_for_state.assert_called_once_with(
          job_id=job_id,
          check_interval=20,
          target_state=TableauJobFinishCode.SUCCESS,
      )
  
file_path: airflow/tests/providers/tableau/operators/test_tableau.py
imports: from __future__ import annotations
  from unittest.mock import Mock, patch
  import pytest
  from airflow.exceptions import AirflowException
  from airflow.providers.tableau.hooks.tableau import TableauJobFinishCode
  from airflow.providers.tableau.operators.tableau import TableauOperator
label_desc: Use image node_id 6 for calling the TestTableauOperator obj's underlying member method code with example usage: obj.test_execute_datasources_blocking(mock_tableau_hook) and returns: mock_tableau_hook, True