fix the way MongoDB URI w/ ?replicaset is passed

This commit is contained in:
Stefan Wojcik
2016-12-12 23:24:19 -05:00
parent a4d0da0085
commit 65914fb2b2
2 changed files with 8 additions and 1 deletions

View File

@@ -200,6 +200,13 @@ class ConnectionTest(unittest.TestCase):
self.assertTrue(isinstance(db, pymongo.database.Database))
self.assertEqual(db.name, 'test')
def test_connect_uri_with_replicaset(self):
"""Ensure connect() works when specifying a replicaSet."""
c = connect(host='mongodb://localhost/test?replicaSet=local-rs')
db = get_db()
self.assertTrue(isinstance(db, pymongo.database.Database))
self.assertEqual(db.name, 'test')
def test_uri_without_credentials_doesnt_override_conn_settings(self):
"""Ensure connect() uses the username & password params if the URI
doesn't explicitly specify them.