File tree Expand file tree Collapse file tree
gateway-api/src/gateway_api/apim_app_auth Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -200,17 +200,26 @@ def method(_: requests.Session) -> None:
200200
201201 method ()
202202
203+ @patch ("gateway_api.apim_app_auth.apim.APIMAppAuthStub" )
203204 @patch ("gateway_api.apim_app_auth.http.SessionManager" )
204205 @patch ("gateway_api.apim_app_auth.apim.jwt.encode" )
205206 def test_auth_unsuccessful_status_code (
206- self , mock_jwt : MagicMock , mock_session_manager : MagicMock
207+ self ,
208+ mock_jwt : MagicMock ,
209+ mock_session_manager : MagicMock ,
210+ mock_apim_app_auth_stub : MagicMock ,
207211 ) -> None :
208212 mock_session_manager .with_session = self .mock_with_session
209213
210214 mock_jwt .return_value = "client_assertion"
211215
212- self .mock_session .post .return_value .status_code = 401
213- self .mock_session .post .return_value .text = "Unauthorized"
216+ mock_apim_app_auth_stub .return_value .session_post .return_value .status_code = 401
217+ mock_apim_app_auth_stub .return_value .session_post .return_value .text = (
218+ "Unauthorized"
219+ )
220+
221+ # self.mock_session.post.return_value.status_code = 401
222+ # self.mock_session.post.return_value.text = "Unauthorized"
214223
215224 apim_authenticator = ApimAuthenticator (
216225 private_key = "private_key" ,
You can’t perform that action at this time.
0 commit comments