@@ -389,14 +389,14 @@ async def test_handshake(
389
389
async def _return_handshake_response (url : URL , params = None , data = None , * _ , ** __ ):
390
390
nonlocal client_seed , server_seed , device_auth_hash
391
391
392
- if str ( url ) == "http://127.0.0.1:80/app/handshake1" :
392
+ if url == URL ( "http://127.0.0.1:80/app/handshake1" ) :
393
393
client_seed = data
394
394
seed_auth_hash = _sha256 (
395
395
seed_auth_hash_calc1 (client_seed , server_seed , device_auth_hash )
396
396
)
397
397
398
398
return _mock_response (200 , server_seed + seed_auth_hash )
399
- elif str ( url ) == "http://127.0.0.1:80/app/handshake2" :
399
+ elif url == URL ( "http://127.0.0.1:80/app/handshake2" ) :
400
400
seed_auth_hash = _sha256 (
401
401
seed_auth_hash_calc2 (client_seed , server_seed , device_auth_hash )
402
402
)
@@ -433,14 +433,14 @@ async def test_query(mocker):
433
433
async def _return_response (url : URL , params = None , data = None , * _ , ** __ ):
434
434
nonlocal client_seed , server_seed , device_auth_hash , seq
435
435
436
- if str ( url ) == "http://127.0.0.1:80/app/handshake1" :
436
+ if url == URL ( "http://127.0.0.1:80/app/handshake1" ) :
437
437
client_seed = data
438
438
client_seed_auth_hash = _sha256 (data + device_auth_hash )
439
439
440
440
return _mock_response (200 , server_seed + client_seed_auth_hash )
441
- elif str ( url ) == "http://127.0.0.1:80/app/handshake2" :
441
+ elif url == URL ( "http://127.0.0.1:80/app/handshake2" ) :
442
442
return _mock_response (200 , b"" )
443
- elif str ( url ) == "http://127.0.0.1:80/app/request" :
443
+ elif url == URL ( "http://127.0.0.1:80/app/request" ) :
444
444
encryption_session = KlapEncryptionSession (
445
445
protocol ._transport ._encryption_session .local_seed ,
446
446
protocol ._transport ._encryption_session .remote_seed ,
@@ -526,21 +526,21 @@ async def _return_response(url: URL, params=None, data=None, *_, **__):
526
526
response_status , \
527
527
credentials_match
528
528
529
- if str ( url ) == "http://127.0.0.1:80/app/handshake1" :
529
+ if url == URL ( "http://127.0.0.1:80/app/handshake1" ) :
530
530
client_seed = data
531
531
client_seed_auth_hash = _sha256 (data + device_auth_hash )
532
532
if credentials_match is not False and credentials_match is not True :
533
533
client_seed_auth_hash += credentials_match
534
534
return _mock_response (
535
535
response_status [0 ], server_seed + client_seed_auth_hash
536
536
)
537
- elif str ( url ) == "http://127.0.0.1:80/app/handshake2" :
537
+ elif url == URL ( "http://127.0.0.1:80/app/handshake2" ) :
538
538
client_seed = data
539
539
client_seed_auth_hash = _sha256 (data + device_auth_hash )
540
540
return _mock_response (
541
541
response_status [1 ], server_seed + client_seed_auth_hash
542
542
)
543
- elif str ( url ) == "http://127.0.0.1:80/app/request" :
543
+ elif url == URL ( "http://127.0.0.1:80/app/request" ) :
544
544
return _mock_response (response_status [2 ], b"" )
545
545
546
546
mocker .patch .object (aiohttp .ClientSession , "post" , side_effect = _return_response )
0 commit comments