@@ -142,9 +142,9 @@ def test_split_options(self):
142
142
self .assertTrue (split_options ("wtimeoutms=500" ))
143
143
self .assertEqual ({"fsync" : True }, split_options ("fsync=true" ))
144
144
self .assertEqual ({"fsync" : False }, split_options ("fsync=false" ))
145
- self .assertEqual ({"authmechanism " : "GSSAPI" }, split_options ("authMechanism=GSSAPI" ))
145
+ self .assertEqual ({"authMechanism " : "GSSAPI" }, split_options ("authMechanism=GSSAPI" ))
146
146
self .assertEqual (
147
- {"authmechanism " : "SCRAM-SHA-1" }, split_options ("authMechanism=SCRAM-SHA-1" )
147
+ {"authMechanism " : "SCRAM-SHA-1" }, split_options ("authMechanism=SCRAM-SHA-1" )
148
148
)
149
149
self .assertEqual ({"authsource" : "foobar" }, split_options ("authSource=foobar" ))
150
150
self .assertEqual ({"maxpoolsize" : 50 }, split_options ("maxpoolsize=50" ))
@@ -290,20 +290,20 @@ def test_parse_uri(self):
290
290
self .assertEqual (res , parse_uri ('mongodb://localhost/test.name/with "delimiters' ))
291
291
292
292
res = copy .deepcopy (orig )
293
- res ["options" ] = {"readpreference " : ReadPreference .SECONDARY .mongos_mode }
293
+ res ["options" ] = {"readPreference " : ReadPreference .SECONDARY .mongos_mode }
294
294
self .assertEqual (res , parse_uri ("mongodb://localhost/?readPreference=secondary" ))
295
295
296
296
# Various authentication tests
297
297
res = copy .deepcopy (orig )
298
- res ["options" ] = {"authmechanism " : "SCRAM-SHA-256" }
298
+ res ["options" ] = {"authMechanism " : "SCRAM-SHA-256" }
299
299
res ["username" ] = "user"
300
300
res ["password" ] = "password"
301
301
self .assertEqual (
302
302
res , parse_uri ("mongodb://user:password@localhost/?authMechanism=SCRAM-SHA-256" )
303
303
)
304
304
305
305
res = copy .deepcopy (orig )
306
- res ["options" ] = {"authmechanism " : "SCRAM-SHA-256" , "authsource " : "bar" }
306
+ res ["options" ] = {"authMechanism " : "SCRAM-SHA-256" , "authSource " : "bar" }
307
307
res ["username" ] = "user"
308
308
res ["password" ] = "password"
309
309
res ["database" ] = "foo"
@@ -315,7 +315,7 @@ def test_parse_uri(self):
315
315
)
316
316
317
317
res = copy .deepcopy (orig )
318
- res ["options" ] = {"authmechanism " : "SCRAM-SHA-256" }
318
+ res ["options" ] = {"authMechanism " : "SCRAM-SHA-256" }
319
319
res ["username" ] = "user"
320
320
res ["password" ] = ""
321
321
self .assertEqual (res , parse_uri ("mongodb://user:@localhost/?authMechanism=SCRAM-SHA-256" ))
@@ -327,7 +327,7 @@ def test_parse_uri(self):
327
327
self .assertEqual (res , parse_uri ("mongodb://user%40domain.com:password@localhost/foo" ))
328
328
329
329
res = copy .deepcopy (orig )
330
- res ["options" ] = {"authmechanism " : "GSSAPI" }
330
+ res ["options" ] = {"authMechanism " : "GSSAPI" }
331
331
res [
"username" ]
= "[email protected] "
332
332
res ["password" ] = "password"
333
333
res ["database" ] = "foo"
@@ -337,7 +337,7 @@ def test_parse_uri(self):
337
337
)
338
338
339
339
res = copy .deepcopy (orig )
340
- res ["options" ] = {"authmechanism " : "GSSAPI" }
340
+ res ["options" ] = {"authMechanism " : "GSSAPI" }
341
341
res [
"username" ]
= "[email protected] "
342
342
res ["password" ] = ""
343
343
res ["database" ] = "foo"
@@ -347,8 +347,8 @@ def test_parse_uri(self):
347
347
348
348
res = copy .deepcopy (orig )
349
349
res ["options" ] = {
350
- "readpreference " : ReadPreference .SECONDARY .mongos_mode ,
351
- "readpreferencetags " : [
350
+ "readPreference " : ReadPreference .SECONDARY .mongos_mode ,
351
+ "readPreferenceTags " : [
352
352
{"dc" : "west" , "use" : "website" },
353
353
{"dc" : "east" , "use" : "website" },
354
354
],
@@ -368,8 +368,8 @@ def test_parse_uri(self):
368
368
369
369
res = copy .deepcopy (orig )
370
370
res ["options" ] = {
371
- "readpreference " : ReadPreference .SECONDARY .mongos_mode ,
372
- "readpreferencetags " : [
371
+ "readPreference " : ReadPreference .SECONDARY .mongos_mode ,
372
+ "readPreferenceTags " : [
373
373
{"dc" : "west" , "use" : "website" },
374
374
{"dc" : "east" , "use" : "website" },
375
375
{},
@@ -462,6 +462,7 @@ def test_tlsinsecure_simple(self):
462
462
"tlsInsecure" : True ,
463
463
"tlsDisableOCSPEndpointCheck" : True ,
464
464
}
465
+ print (parse_uri (uri )["options" ])
465
466
self .assertEqual (res , parse_uri (uri )["options" ])
466
467
467
468
def test_normalize_options (self ):
@@ -479,8 +480,8 @@ def test_unquote_during_parsing(self):
479
480
)
480
481
res = parse_uri (uri )
481
482
options : dict [str , Any ] = {
482
- "authmechanism " : "MONGODB-AWS" ,
483
- "authmechanismproperties " : {"AWS_SESSION_TOKEN" : unquoted_val },
483
+ "authMechanism " : "MONGODB-AWS" ,
484
+ "authMechanismProperties " : {"AWS_SESSION_TOKEN" : unquoted_val },
484
485
}
485
486
self .assertEqual (options , res ["options" ])
486
487
@@ -491,8 +492,8 @@ def test_unquote_during_parsing(self):
491
492
)
492
493
res = parse_uri (uri )
493
494
options = {
494
- "readpreference " : ReadPreference .SECONDARY .mongos_mode ,
495
- "readpreferencetags " : [
495
+ "readPreference " : ReadPreference .SECONDARY .mongos_mode ,
496
+ "readPreferenceTags " : [
496
497
{"dc" : "west" , unquoted_val : unquoted_val },
497
498
{"dc" : "east" , "use" : unquoted_val },
498
499
],
@@ -519,7 +520,7 @@ def test_handle_colon(self):
519
520
)
520
521
res = parse_uri (uri )
521
522
options = {
522
- "authmechanism " : "MONGODB-AWS" ,
523
+ "authMechanism " : "MONGODB-AWS" ,
523
524
"authMechanismProperties" : {"AWS_SESSION_TOKEN" : token },
524
525
}
525
526
self .assertEqual (options , res ["options" ])
0 commit comments