@@ -31,11 +31,11 @@ def test_service_checks_healthy_exp(aggregator, json_resp, expected_healthy_stat
31
31
check = AirflowCheck ('airflow' , common .FULL_CONFIG , [instance ])
32
32
33
33
with mock .patch ('datadog_checks.airflow.airflow.AirflowCheck._get_version' , return_value = None ):
34
-
35
- with mock .patch ('datadog_checks.base.utils.http.requests' ) as req :
34
+ mock_session = mock . MagicMock ()
35
+ with mock .patch ('datadog_checks.base.utils.http.requests.Session' , return_value = mock_session ) :
36
36
mock_resp = mock .MagicMock (status_code = 200 )
37
37
mock_resp .json .side_effect = [json_resp ]
38
- req .get .return_value = mock_resp
38
+ mock_session .get .return_value = mock_resp
39
39
40
40
check .check (None )
41
41
@@ -60,14 +60,14 @@ def test_service_checks_healthy_stable(
60
60
check = AirflowCheck ('airflow' , common .FULL_CONFIG , [instance ])
61
61
62
62
with mock .patch ('datadog_checks.airflow.airflow.AirflowCheck._get_version' , return_value = '2.6.2' ):
63
-
64
- with mock .patch ('datadog_checks.base.utils.http.requests' ) as req :
63
+ mock_session = mock . MagicMock ()
64
+ with mock .patch ('datadog_checks.base.utils.http.requests.Session' , return_value = mock_session ) :
65
65
mock_resp = mock .MagicMock (status_code = 200 )
66
66
mock_resp .json .side_effect = [
67
67
{'metadatabase' : {'status' : metadb_status }, 'scheduler' : {'status' : scheduler_status }},
68
68
{'status' : 'OK' },
69
69
]
70
- req .get .return_value = mock_resp
70
+ mock_session .get .return_value = mock_resp
71
71
72
72
check .check (None )
73
73
0 commit comments