fix tests
This commit is contained in:
parent
b1d8aca46a
commit
553f496d84
@ -202,10 +202,16 @@ class ConnectionTest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_connect_uri_with_replicaset(self):
|
def test_connect_uri_with_replicaset(self):
|
||||||
"""Ensure connect() works when specifying a replicaSet."""
|
"""Ensure connect() works when specifying a replicaSet."""
|
||||||
c = connect(host='mongodb://localhost/test?replicaSet=local-rs')
|
if IS_PYMONGO_3:
|
||||||
db = get_db()
|
c = connect(host='mongodb://localhost/test?replicaSet=local-rs')
|
||||||
self.assertTrue(isinstance(db, pymongo.database.Database))
|
db = get_db()
|
||||||
self.assertEqual(db.name, 'test')
|
self.assertTrue(isinstance(db, pymongo.database.Database))
|
||||||
|
self.assertEqual(db.name, 'test')
|
||||||
|
else:
|
||||||
|
# PyMongo < v3.x raises an exception:
|
||||||
|
# "localhost:27017 is not a member of replica set local-rs"
|
||||||
|
with self.assertRaises(MongoEngineConnectionError):
|
||||||
|
c = connect(host='mongodb://localhost/test?replicaSet=local-rs')
|
||||||
|
|
||||||
def test_uri_without_credentials_doesnt_override_conn_settings(self):
|
def test_uri_without_credentials_doesnt_override_conn_settings(self):
|
||||||
"""Ensure connect() uses the username & password params if the URI
|
"""Ensure connect() uses the username & password params if the URI
|
||||||
|
Loading…
x
Reference in New Issue
Block a user