Mongo clients with the same settings should be shared since they manage a connection pool.
Also, I removed old code that was supposed to support Pymongo<2.1 which we don't support anymore.
This commit is contained in:
		| @@ -34,6 +34,17 @@ class ConnectionTest(unittest.TestCase): | ||||
|         conn = get_connection('testdb') | ||||
|         self.assertTrue(isinstance(conn, pymongo.mongo_client.MongoClient)) | ||||
|  | ||||
|     def test_sharing_connections(self): | ||||
|         """Ensure that connections are shared when the connection settings are exactly the same | ||||
|         """ | ||||
|         connect('mongoenginetest', alias='testdb1') | ||||
|  | ||||
|         expected_connection = get_connection('testdb1') | ||||
|  | ||||
|         connect('mongoenginetest', alias='testdb2') | ||||
|         actual_connection = get_connection('testdb2') | ||||
|         self.assertIs(expected_connection, actual_connection) | ||||
|  | ||||
|     def test_connect_uri(self): | ||||
|         """Ensure that the connect() method works properly with uri's | ||||
|         """ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user