Ensure that connections with different aliases may be registered.
(self)
| 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.""" |
nothing calls this directly
no test coverage detected