Ensure that the connect() method works properly.
(self)
| 58 | mongoengine.connection._dbs = {} |
| 59 | |
| 60 | def test_connect(self): |
| 61 | """Ensure that the connect() method works properly.""" |
| 62 | connect("mongoenginetest") |
| 63 | |
| 64 | conn = get_connection() |
| 65 | assert isinstance(conn, pymongo.MongoClient) |
| 66 | |
| 67 | db = get_db() |
| 68 | assert isinstance(db, pymongo.database.Database) |
| 69 | assert db.name == "mongoenginetest" |
| 70 | |
| 71 | connect("mongoenginetest2", alias="testdb") |
| 72 | conn = get_connection("testdb") |
| 73 | assert isinstance(conn, pymongo.MongoClient) |
| 74 | |
| 75 | connect( |
| 76 | "mongoenginetest2", alias="testdb3", mongo_client_class=pymongo.MongoClient |
| 77 | ) |
| 78 | conn = get_connection("testdb") |
| 79 | assert isinstance(conn, pymongo.MongoClient) |
| 80 | |
| 81 | def test_connect_disconnect_works_properly(self): |
| 82 | class History1(Document): |
nothing calls this directly
no test coverage detected