File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -121,8 +121,10 @@ def create_connections(config: dict):
121121 connections = {}
122122 for connection_setting in connection_settings :
123123 alias = connection_setting .setdefault (
124- "alias" , mongoengine .DEFAULT_CONNECTION_NAME
124+ "alias" ,
125+ mongoengine .DEFAULT_CONNECTION_NAME ,
125126 )
127+ connection_setting .setdefault ("uuidRepresentation" , "standard" )
126128 connections [alias ] = mongoengine .connect (** connection_setting )
127129
128130 return connections
Original file line number Diff line number Diff line change @@ -38,7 +38,15 @@ def app() -> Flask:
3838
3939@pytest .fixture ()
4040def db (app ) -> MongoEngine :
41- app .config ["MONGODB_HOST" ] = "mongodb://localhost:27017/flask_mongoengine_test_db"
41+ app .config ["MONGODB_SETTINGS" ] = [
42+ {
43+ "db" : "flask_mongoengine_test_db" ,
44+ "host" : "localhost" ,
45+ "port" : 27017 ,
46+ "alias" : "default" ,
47+ "uuidRepresentation" : "standard" ,
48+ }
49+ ]
4250 test_db = MongoEngine (app )
4351 db_name = (
4452 test_db .connection ["default" ].get_database ("flask_mongoengine_test_db" ).name
Original file line number Diff line number Diff line change 77@pytest .fixture ()
88def extended_db (app ):
99 app .json_encoder = DummyEncoder
10- app .config ["MONGODB_HOST" ] = "mongodb://localhost:27017/flask_mongoengine_test_db"
10+ app .config ["MONGODB_SETTINGS" ] = [
11+ {
12+ "db" : "flask_mongoengine_test_db" ,
13+ "host" : "localhost" ,
14+ "port" : 27017 ,
15+ "alias" : "default" ,
16+ "uuidRepresentation" : "standard" ,
17+ }
18+ ]
1119 test_db = MongoEngine (app )
1220 db_name = (
1321 test_db .connection ["default" ].get_database ("flask_mongoengine_test_db" ).name
You can’t perform that action at this time.
0 commit comments