From 6f82835a51f9aa6b59d27742d7a6845e85641a81 Mon Sep 17 00:00:00 2001 From: Tatiana Al-Chueyr Date: Wed, 31 Jan 2024 15:53:40 +0000 Subject: [PATCH] new attempt --- tests/operators/test_kubernetes.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/operators/test_kubernetes.py b/tests/operators/test_kubernetes.py index e00b0b1a8..29fe54084 100644 --- a/tests/operators/test_kubernetes.py +++ b/tests/operators/test_kubernetes.py @@ -226,18 +226,18 @@ def cleanup(pod: str, remote_pod: str): test_operator._handle_warnings(context) -@patch("airflow.providers.cncf.kubernetes.hooks.kubernetes.config.load_incluster_config") -@patch("airflow.providers.cncf.kubernetes.operators.pod.KubernetesPodOperator.hook._get_default_client") @patch("airflow.providers.cncf.kubernetes.operators.pod.KubernetesPodOperator.hook") -@patch("cosmos.operators.kubernetes.KubernetesPodOperator.hook") -def test_created_pod(test_hook1, test_hook2, test_client, load_cluster_config): - test_hook1.is_in_cluster = False - test_hook2.is_in_cluster = False - test_hook1._get_namespace.return_value.to_dict.return_value = "foo" - test_hook2._get_namespace.return_value.to_dict.return_value = "foo" +def test_created_pod(test_hook): + test_hook.is_in_cluster = False + test_hook._get_namespace.return_value.to_dict.return_value = "foo" ls_kwargs = {"env_vars": {"FOO": "BAR"}} ls_kwargs.update(base_kwargs) ls_operator = DbtLSKubernetesOperator(**ls_kwargs) + from unittest.mock import MagicMock + + ls_operator.hook = MagicMock() + ls_operator.hook.is_in_cluster = False + ls_operator.hook._get_namespace.return_value.to_dict.return_value = "foo" ls_operator.build_kube_args(context={}, cmd_flags=MagicMock()) pod_obj = ls_operator.build_pod_request_obj() expected_result = {