baruch-shteken commented on issue #25904:
URL: https://github.com/apache/airflow/issues/25904#issuecomment-1761646107

   I started working on fixing this issue.
   I read the [Tableau Python SDK 
docs](https://tableau.github.io/server-client-python/docs/api-ref#personalaccesstokenauth-class)
 and I didn't see any meaningful feature that can help solving this problem.
   I decided that what I can do changing the connection setting in the Tableau 
hook.
   Instead of generating the connection 1 time when the hook is initialized 
([__enter__ 
function](https://github.com/apache/airflow/blob/main/airflow/providers/tableau/hooks/tableau.py#L98)),
 I would like the tableau connection to be set before any API request to 
Tableau. This should solve the problem because the Tableau session_token will 
be newly generated before every call.
   The problem is that I don't know how to write a test for that. I need to 
write a test that checks how many times `tableau_conn` was set to a value after 
mocking a Tableau API call (current code 1 time, my code 2 times). I looked 
into the exiting unit tests for the [TableauHook 
class](https://github.com/apache/airflow/blob/main/tests/providers/tableau/hooks/test_tableau.py)
 but I didn't get any inspiration of how to create my test. Can anyone help me 
in this approach?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to