@@ -15,7 +15,7 @@ def setup_method(self):
1515 """Set up test fixtures"""
1616 self .client = JupiterOneClient (account = "test-account" , token = "test-token" )
1717
18- @patch ('jupiterone.client. requests.post' )
18+ @patch ('requests.Session .post' )
1919 def test_list_questions_basic (self , mock_post ):
2020 """Test basic questions listing with single page"""
2121 # Mock response for single page
@@ -101,7 +101,7 @@ def test_list_questions_basic(self, mock_post):
101101 assert call_args [1 ]['json' ]['query' ] == QUESTIONS
102102 assert call_args [1 ]['json' ]['flags' ]['variableResultSize' ] is True
103103
104- @patch ('jupiterone.client. requests.post' )
104+ @patch ('requests.Session .post' )
105105 def test_list_questions_with_pagination (self , mock_post ):
106106 """Test questions listing with multiple pages"""
107107 # Mock first page response
@@ -198,7 +198,7 @@ def test_list_questions_with_pagination(self, mock_post):
198198 assert second_call [1 ]['json' ]['variables' ]['cursor' ] == "cursor-1"
199199 assert second_call [1 ]['json' ]['flags' ]['variableResultSize' ] is True
200200
201- @patch ('jupiterone.client. requests.post' )
201+ @patch ('requests.Session .post' )
202202 def test_list_questions_empty_response (self , mock_post ):
203203 """Test questions listing with empty response"""
204204 # Mock empty response
@@ -227,7 +227,7 @@ def test_list_questions_empty_response(self, mock_post):
227227 # Verify API call
228228 mock_post .assert_called_once ()
229229
230- @patch ('jupiterone.client. requests.post' )
230+ @patch ('requests.Session .post' )
231231 def test_list_questions_with_compliance_data (self , mock_post ):
232232 """Test questions listing with compliance metadata"""
233233 # Mock response with compliance data
@@ -279,7 +279,7 @@ def test_list_questions_with_compliance_data(self, mock_post):
279279 assert compliance ['requirements' ] == ["2.1" , "2.2" , "2.3" ]
280280 assert compliance ['controls' ] == ["Data Protection" , "Network Security" ]
281281
282- @patch ('jupiterone.client. requests.post' )
282+ @patch ('requests.Session .post' )
283283 def test_list_questions_with_variables (self , mock_post ):
284284 """Test questions listing with variable definitions"""
285285 # Mock response with variables
@@ -341,7 +341,7 @@ def test_list_questions_with_variables(self, mock_post):
341341 assert variables [1 ]['required' ] is False
342342 assert variables [1 ]['default' ] == "us-east-1"
343343
344- @patch ('jupiterone.client. requests.post' )
344+ @patch ('requests.Session .post' )
345345 def test_list_questions_with_polling_intervals (self , mock_post ):
346346 """Test questions listing with different polling intervals"""
347347 # Mock response with various polling intervals
@@ -413,7 +413,7 @@ def test_list_questions_with_polling_intervals(self, mock_post):
413413 assert result [1 ]['showTrend' ] is True
414414 assert result [2 ]['showTrend' ] is False
415415
416- @patch ('jupiterone.client. requests.post' )
416+ @patch ('requests.Session .post' )
417417 def test_list_questions_error_handling (self , mock_post ):
418418 """Test questions listing with error handling"""
419419 # Mock error response
@@ -433,7 +433,7 @@ def test_list_questions_error_handling(self, mock_post):
433433 with pytest .raises (Exception ):
434434 self .client .list_questions ()
435435
436- @patch ('jupiterone.client. requests.post' )
436+ @patch ('requests.Session .post' )
437437 def test_list_questions_malformed_response (self , mock_post ):
438438 """Test questions listing with malformed response"""
439439 # Mock malformed response
@@ -466,7 +466,7 @@ def test_list_questions_malformed_response(self, mock_post):
466466 # Missing fields should be None or not present
467467 assert 'title' not in question or question ['title' ] is None
468468
469- @patch ('jupiterone.client. requests.post' )
469+ @patch ('requests.Session .post' )
470470 def test_list_questions_with_search_query (self , mock_post ):
471471 """Test questions listing with search query parameter"""
472472 # Mock response for search query
@@ -512,7 +512,7 @@ def test_list_questions_with_search_query(self, mock_post):
512512 call_args = mock_post .call_args
513513 assert call_args [1 ]['json' ]['variables' ]['searchQuery' ] == "security"
514514
515- @patch ('jupiterone.client. requests.post' )
515+ @patch ('requests.Session .post' )
516516 def test_list_questions_with_tags_filter (self , mock_post ):
517517 """Test questions listing with tags filter parameter"""
518518 # Mock response for tags filter
@@ -563,7 +563,7 @@ def test_list_questions_with_tags_filter(self, mock_post):
563563 call_args = mock_post .call_args
564564 assert call_args [1 ]['json' ]['variables' ]['tags' ] == ["cis" , "aws" ]
565565
566- @patch ('jupiterone.client. requests.post' )
566+ @patch ('requests.Session .post' )
567567 def test_list_questions_with_search_and_tags (self , mock_post ):
568568 """Test questions listing with both search query and tags filter"""
569569 # Mock response for combined search and tags
@@ -620,7 +620,7 @@ def test_list_questions_with_search_and_tags(self, mock_post):
620620 assert variables ['searchQuery' ] == "encryption"
621621 assert variables ['tags' ] == ["security" , "compliance" ]
622622
623- @patch ('jupiterone.client. requests.post' )
623+ @patch ('requests.Session .post' )
624624 def test_list_questions_with_pagination_and_filters (self , mock_post ):
625625 """Test questions listing with filters and pagination"""
626626 # Mock first page response with filters
@@ -709,7 +709,7 @@ def test_list_questions_with_pagination_and_filters(self, mock_post):
709709 assert second_variables ['tags' ] == ["security" ]
710710 assert second_variables ['cursor' ] == "cursor-1"
711711
712- @patch ('jupiterone.client. requests.post' )
712+ @patch ('requests.Session .post' )
713713 def test_list_questions_no_parameters (self , mock_post ):
714714 """Test questions listing with no parameters (default behavior)"""
715715 # Mock response for no parameters
@@ -753,7 +753,7 @@ def test_list_questions_no_parameters(self, mock_post):
753753 call_args = mock_post .call_args
754754 assert call_args [1 ]['json' ]['variables' ] == {}
755755
756- @patch ('jupiterone.client. requests.post' )
756+ @patch ('requests.Session .post' )
757757 def test_list_questions_empty_search_results (self , mock_post ):
758758 """Test questions listing with search that returns no results"""
759759 # Mock empty response for search
@@ -784,7 +784,7 @@ def test_list_questions_empty_search_results(self, mock_post):
784784 call_args = mock_post .call_args
785785 assert call_args [1 ]['json' ]['variables' ]['searchQuery' ] == "nonexistent"
786786
787- @patch ('jupiterone.client. requests.post' )
787+ @patch ('requests.Session .post' )
788788 def test_list_questions_empty_tags_results (self , mock_post ):
789789 """Test questions listing with tags filter that returns no results"""
790790 # Mock empty response for tags filter
0 commit comments