@@ -236,40 +236,53 @@ def test_disconnect(self):
236
236
coll .count ()
237
237
238
238
def test_parse_uri (self ):
239
- self .assertEqual (([("localhost" , 27017 )], None , None , None ),
239
+ self .assertEqual (([("localhost" , 27017 )], None , None , None , None , {} ),
240
240
_parse_uri ("localhost" , 27017 ))
241
- self .assertEqual (([("localhost" , 27018 )], None , None , None ),
241
+ self .assertEqual (([("localhost" , 27018 )], None , None , None , None , {} ),
242
242
_parse_uri ("localhost" , 27018 ))
243
243
self .assertRaises (InvalidURI , _parse_uri ,
244
244
"http://foobar.com" , 27017 )
245
245
self .assertRaises (InvalidURI , _parse_uri ,
246
246
"http://[email protected] " ,
27017 )
247
247
248
- self .assertEqual (([("localhost" , 27017 )], None , None , None ),
248
+ self .assertEqual (([("localhost" , 27017 )], None , None , None , None , {} ),
249
249
_parse_uri ("mongodb://localhost" , 27017 ))
250
- self .assertEqual (([("localhost" , 27017 )], None , "fred" , "foobar" ),
250
+ self .assertEqual (([("localhost" , 27017 )], None , "fred" , "foobar" , None , {} ),
251
251
_parse_uri ("mongodb://fred:foobar@localhost" ,
252
252
27017 ))
253
- self .assertEqual (([("localhost" , 27017 )], "baz" , "fred" , "foobar" ),
253
+ self .assertEqual (([("localhost" , 27017 )], "baz" , "fred" , "foobar" , None , {} ),
254
254
_parse_uri ("mongodb://fred:foobar@localhost/baz" ,
255
255
27017 ))
256
256
self .assertEqual (([("example1.com" , 27017 ), ("example2.com" , 27017 )],
257
- None , None , None ),
257
+ None , None , None , None , {} ),
258
258
_parse_uri ("mongodb://example1.com:27017,example2.com:27017" ,
259
259
27018 ))
260
260
self .assertEqual (([("localhost" , 27017 ),
261
261
("localhost" , 27018 ),
262
- ("localhost" , 27019 )], None , None , None ),
262
+ ("localhost" , 27019 )], None , None , None , None , {} ),
263
263
_parse_uri ("mongodb://localhost,localhost:27018,localhost:27019" ,
264
264
27017 ))
265
265
266
- self .assertEqual (([("localhost" , 27018 )], None , None , None ),
266
+ self .assertEqual (([("localhost" , 27018 )], None , None , None , None , {} ),
267
267
_parse_uri ("localhost:27018" , 27017 ))
268
- self .assertEqual (([("localhost" , 27017 )], "foo" , None , None ),
268
+ self .assertEqual (([("localhost" , 27017 )], "foo" , None , None , None , {} ),
269
269
_parse_uri ("localhost/foo" , 27017 ))
270
- self .assertEqual (([("localhost" , 27017 )], None , None , None ),
270
+ self .assertEqual (([("localhost" , 27017 )], None , None , None , None , {} ),
271
271
_parse_uri ("localhost/" , 27017 ))
272
272
273
+ self .assertEqual (([("localhost" , 27017 )], "test" , None , None , "yield_historical.in" , {}),
274
+ _parse_uri ("mongodb://localhost/test.yield_historical.in" , 27017 ))
275
+ self .assertEqual (([("localhost" , 27017 )], "test" , "fred" , "foobar" , "yield_historical.in" , {}),
276
+ _parse_uri ("mongodb://fred:foobar@localhost/test.yield_historical.in" ,
277
+ 27017 ))
278
+ self .assertEqual (([("example1.com" , 27017 ), ("example2.com" , 27017 )],
279
+ "test" , None , None , "yield_historical.in" , {}),
280
+ _parse_uri ("mongodb://example1.com:27017,example2.com:27017/test.yield_historical.in" ,
281
+ 27017 ))
282
+ self .assertEqual (([("localhost" , 27017 )], "test" , "fred" , "foobar" , "yield_historical.in" , {'slaveok' : 'true' }),
283
+ _parse_uri ("mongodb://fred:foobar@localhost/test.yield_historical.in?slaveok=true" ,
284
+ 27017 ))
285
+
273
286
def test_from_uri (self ):
274
287
c = Connection (self .host , self .port )
275
288
@@ -304,6 +317,8 @@ def test_from_uri(self):
304
317
self .assert_ (Connection ("mongodb://%s:%s" %
305
318
(self .host , self .port ),
306
319
slave_okay = True ).slave_okay )
320
+ self .assert_ (Connection ("mongodb://%s:%s/?slaveok=true;w=2" %
321
+ (self .host , self .port )).slave_okay )
307
322
308
323
def test_fork (self ):
309
324
"""Test using a connection before and after a fork.
0 commit comments