MCPcopy Create free account
hub / github.com/MongoEngine/mongoengine / test_register_connection

Method test_register_connection

tests/test_connection.py:530–541  ·  view source on GitHub ↗

Ensure that connections with different aliases may be registered.

(self)

Source from the content-addressed store, hash-verified

528 authd_conn.admin.system.users.delete_many({})
529
530 def test_register_connection(self):
531 """Ensure that connections with different aliases may be registered."""
532 register_connection("testdb", "mongoenginetest2")
533
534 with pytest.raises(ConnectionFailure):
535 get_connection()
536 conn = get_connection("testdb")
537 assert isinstance(conn, pymongo.mongo_client.MongoClient)
538
539 db = get_db("testdb")
540 assert isinstance(db, pymongo.database.Database)
541 assert db.name == "mongoenginetest2"
542
543 def test_register_connection_defaults(self):
544 """Ensure that defaults are used when the host and port are None."""

Callers

nothing calls this directly

Calls 3

register_connectionFunction · 0.90
get_connectionFunction · 0.90
get_dbFunction · 0.90

Tested by

no test coverage detected