33from datetime import datetime , timedelta , timezone
44from typing import Optional , cast
55
6- import neo4j
76import pytest
87from pytest_mock import MockerFixture
98
@@ -350,10 +349,13 @@ def test_create_attached_session(mocker: MockerFixture, aura_api: AuraApi) -> No
350349 arrow_authentication = gds_parameters ["arrow_authentication" ] # type: ignore
351350 del gds_parameters ["arrow_authentication" ]
352351
352+ dbms_authentication = gds_parameters ["db_runner" ].pop ("auth" ) # type: ignore
353+
354+ assert (dbms_authentication .principal , dbms_authentication .credentials ) == ("dbuser" , "db_pw" )
355+
353356 assert gds_parameters == { # type: ignore
354357 "db_runner" : {
355358 "endpoint" : "neo4j+s://ffff0.databases.neo4j.io" ,
356- "auth" : neo4j .basic_auth ("dbuser" , "db_pw" ),
357359 "aura_ds" : True ,
358360 "database" : None ,
359361 "show_progress" : False ,
@@ -394,10 +396,13 @@ def test_create_standalone_session(mocker: MockerFixture, aura_api: AuraApi) ->
394396 arrow_authentication = gds_credentials ["arrow_authentication" ] # type: ignore
395397 del gds_credentials ["arrow_authentication" ]
396398
399+ dbms_authentication = gds_credentials ["db_runner" ].pop ("auth" ) # type: ignore
400+
401+ assert (dbms_authentication .principal , dbms_authentication .credentials ) == ("dbuser" , "db_pw" )
402+
397403 assert gds_credentials == { # type: ignore
398404 "db_runner" : {
399405 "endpoint" : "neo4j+s://foo.bar" ,
400- "auth" : neo4j .basic_auth ("dbuser" , "db_pw" ),
401406 "aura_ds" : True ,
402407 "database" : None ,
403408 "show_progress" : False ,
@@ -442,10 +447,15 @@ def test_get_or_create(mocker: MockerFixture, aura_api: AuraApi) -> None:
442447 del gds_args1 ["arrow_authentication" ]
443448 del gds_args2 ["arrow_authentication" ]
444449
450+ actual_auth_1 = gds_args1 ["db_runner" ].pop ("auth" ) # type: ignore
451+ actual_auth_2 = gds_args2 ["db_runner" ].pop ("auth" ) # type: ignore
452+
453+ assert (actual_auth_1 .principal , actual_auth_1 .credentials ) == ("dbuser" , "db_pw" )
454+ assert (actual_auth_2 .principal , actual_auth_2 .credentials ) == ("dbuser" , "db_pw" )
455+
445456 assert gds_args1 == { # type: ignore
446457 "db_runner" : {
447458 "endpoint" : "neo4j+s://ffff0.databases.neo4j.io" ,
448- "auth" : neo4j .basic_auth ("dbuser" , "db_pw" ),
449459 "aura_ds" : True ,
450460 "database" : None ,
451461 "show_progress" : False ,
@@ -456,6 +466,7 @@ def test_get_or_create(mocker: MockerFixture, aura_api: AuraApi) -> None:
456466 ),
457467 "session_id" : "ffff0-ffff1" ,
458468 }
469+
459470 assert gds_args1 == gds_args2
460471
461472 assert isinstance (arrow_authentication , AuraApiTokenAuthentication )
0 commit comments