@@ -35,7 +35,10 @@ def test_get_idp_url(self, mock_get_request, mock_response):
3535 mock_get_request .return_value = mock_response
3636 mock_response .json .return_value = {"redirect_url" : "response_redirect_url" }
3737
38- assert get_idp_url (self .api_host , "test_org" ) == "response_redirect_url"
38+ assert (
39+ get_idp_url (self .api_host , "test_org" , session = requests .sessions .Session ())
40+ == "response_redirect_url"
41+ )
3942 mock_get_request .assert_called_once_with (
4043 f"{ self .api_host } /orgs/test_org/saml/?{ self .query_params } " , timeout = 30
4144 )
@@ -50,7 +53,7 @@ def test_get_idp_url_with_request_error(self, mock_get_request, mock_response):
5053 )
5154
5255 with pytest .raises (ApiException ) as exc :
53- get_idp_url (self .api_host , "test_org" )
56+ get_idp_url (self .api_host , "test_org" , session = requests . sessions . Session () )
5457
5558 assert exc == ApiException (
5659 status = 500 , headers = {"foo" : "bar" }, body = "Error body"
@@ -66,7 +69,12 @@ def test_exchange_2fa_token(self, mock_post_request, mock_response):
6669 "refresh_token" : "refresh_token" ,
6770 }
6871
69- assert exchange_2fa_token (self .api_host , "two_factor_token" , "totp_token" ) == (
72+ assert exchange_2fa_token (
73+ self .api_host ,
74+ "two_factor_token" ,
75+ "totp_token" ,
76+ session = requests .sessions .Session (),
77+ ) == (
7078 "access_token" ,
7179 "refresh_token" ,
7280 )
@@ -89,7 +97,12 @@ def test_exchange_2fa_token_with_request_error(
8997 )
9098
9199 with pytest .raises (ApiException ) as exc :
92- exchange_2fa_token (self .api_host , "two_factor_token" , "totp_token" )
100+ exchange_2fa_token (
101+ self .api_host ,
102+ "two_factor_token" ,
103+ "totp_token" ,
104+ session = requests .sessions .Session (),
105+ )
93106
94107 assert exc == ApiException (
95108 status = 500 , headers = {"foo" : "bar" }, body = "Error body"
@@ -111,7 +124,12 @@ def test_refresh_access_token(self, mock_post_request, mock_response):
111124 "refresh_token" : "refresh_token" ,
112125 }
113126
114- assert refresh_access_token (self .api_host , "access_token" , "refresh_token" ) == (
127+ assert refresh_access_token (
128+ self .api_host ,
129+ "access_token" ,
130+ "refresh_token" ,
131+ session = requests .sessions .Session (),
132+ ) == (
115133 "access_token" ,
116134 "refresh_token" ,
117135 )
@@ -138,7 +156,12 @@ def test_refresh_access_token_with_request_error(
138156 }
139157
140158 with pytest .raises (ApiException ) as exc :
141- exchange_2fa_token (self .api_host , "two_factor_token" , "totp_token" )
159+ exchange_2fa_token (
160+ self .api_host ,
161+ "two_factor_token" ,
162+ "totp_token" ,
163+ session = requests .sessions .Session (),
164+ )
142165
143166 assert exc == ApiException (
144167 status = 500 , headers = {"foo" : "bar" }, body = "Error body"
0 commit comments