File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
redis_enterprise_prometheus/tests Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -25,12 +25,16 @@ def mock_http_response():
2525 f_name = os .path .join (os .path .dirname (__file__ ), "data" , "metrics.txt" )
2626 with open (f_name , "r" ) as f :
2727 text_data = f .read ()
28- with mock .patch (
29- "requests.get" ,
30- return_value = mock .MagicMock (
31- status_code = 200 ,
32- iter_lines = lambda ** kwargs : text_data .split ("\n " ),
33- headers = {"Content-Type" : "text/plain" },
34- ),
28+
29+ mock_response = mock .MagicMock ()
30+ mock_response .status_code = 200
31+ mock_response .content = text_data
32+ mock_response .text = text_data
33+ mock_response .iter_lines = lambda ** kwargs : text_data .split ("\n " )
34+ mock_response .headers = {"Content-Type" : "text/plain" }
35+
36+ with (
37+ mock .patch ("requests.get" , return_value = mock_response ),
38+ mock .patch ("requests.Session.get" , return_value = mock_response ),
3539 ):
3640 yield
You can’t perform that action at this time.
0 commit comments