3
3
from datetime import datetime , timedelta , timezone
4
4
from typing import Optional , cast
5
5
6
- import neo4j
7
6
import pytest
8
7
from pytest_mock import MockerFixture
9
8
@@ -350,10 +349,13 @@ def test_create_attached_session(mocker: MockerFixture, aura_api: AuraApi) -> No
350
349
arrow_authentication = gds_parameters ["arrow_authentication" ] # type: ignore
351
350
del gds_parameters ["arrow_authentication" ]
352
351
352
+ dbms_authentication = gds_parameters ["db_runner" ].pop ("auth" ) # type: ignore
353
+
354
+ assert (dbms_authentication .principal , dbms_authentication .credentials ) == ("dbuser" , "db_pw" )
355
+
353
356
assert gds_parameters == { # type: ignore
354
357
"db_runner" : {
355
358
"endpoint" : "neo4j+s://ffff0.databases.neo4j.io" ,
356
- "auth" : neo4j .basic_auth ("dbuser" , "db_pw" ),
357
359
"aura_ds" : True ,
358
360
"database" : None ,
359
361
"show_progress" : False ,
@@ -394,10 +396,13 @@ def test_create_standalone_session(mocker: MockerFixture, aura_api: AuraApi) ->
394
396
arrow_authentication = gds_credentials ["arrow_authentication" ] # type: ignore
395
397
del gds_credentials ["arrow_authentication" ]
396
398
399
+ dbms_authentication = gds_credentials ["db_runner" ].pop ("auth" ) # type: ignore
400
+
401
+ assert (dbms_authentication .principal , dbms_authentication .credentials ) == ("dbuser" , "db_pw" )
402
+
397
403
assert gds_credentials == { # type: ignore
398
404
"db_runner" : {
399
405
"endpoint" : "neo4j+s://foo.bar" ,
400
- "auth" : neo4j .basic_auth ("dbuser" , "db_pw" ),
401
406
"aura_ds" : True ,
402
407
"database" : None ,
403
408
"show_progress" : False ,
@@ -442,10 +447,15 @@ def test_get_or_create(mocker: MockerFixture, aura_api: AuraApi) -> None:
442
447
del gds_args1 ["arrow_authentication" ]
443
448
del gds_args2 ["arrow_authentication" ]
444
449
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
+
445
456
assert gds_args1 == { # type: ignore
446
457
"db_runner" : {
447
458
"endpoint" : "neo4j+s://ffff0.databases.neo4j.io" ,
448
- "auth" : neo4j .basic_auth ("dbuser" , "db_pw" ),
449
459
"aura_ds" : True ,
450
460
"database" : None ,
451
461
"show_progress" : False ,
@@ -456,6 +466,7 @@ def test_get_or_create(mocker: MockerFixture, aura_api: AuraApi) -> None:
456
466
),
457
467
"session_id" : "ffff0-ffff1" ,
458
468
}
469
+
459
470
assert gds_args1 == gds_args2
460
471
461
472
assert isinstance (arrow_authentication , AuraApiTokenAuthentication )
0 commit comments