@@ -225,16 +225,16 @@ async def test_query_retry(self): # , mock_refresh, mock_validate):
225225 @mock .patch ("blinkpy.auth.Auth.validate_response" )
226226 @mock .patch ("blinkpy.auth.Auth.refresh_tokens" )
227227 async def test_query_retry_failed (self , mock_refresh , mock_validate ):
228- """Check handling of failed retry request ."""
228+ """Check authorization failure is thrown ."""
229229 self .auth .session = MockSession ()
230230 mock_validate .side_effect = [
231231 BlinkBadResponse ,
232232 UnauthorizedError ,
233- TokenRefreshFailed ,
234233 ]
235234 mock_refresh .return_value = True
236235 self .assertEqual (await self .auth .query (url = "http://example.com" ), None )
237- self .assertEqual (await self .auth .query (url = "http://example.com" ), None )
236+ with self .assertRaises (UnauthorizedError ):
237+ await self .auth .query (url = "http://example.com" )
238238
239239 @mock .patch ("blinkpy.auth.Auth.validate_response" )
240240 async def test_query (self , mock_validate ):
@@ -250,8 +250,8 @@ async def test_query(self, mock_validate):
250250 self .assertIsNone (await self .auth .query ("URL" , "data" , "headers" , "post" ))
251251
252252 mock_validate .side_effect = UnauthorizedError
253- self .auth . refresh_tokens = mock . AsyncMock ()
254- self . assertIsNone ( await self .auth .query ("URL" , "data" , "headers" , "post" ) )
253+ with self .assertRaises ( UnauthorizedError ):
254+ await self .auth .query ("URL" , "data" , "headers" , "post" )
255255
256256 @mock .patch ("blinkpy.auth.Auth.validate_response" )
257257 @mock .patch ("blinkpy.auth.Auth.validate_login" )
0 commit comments