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):
121
121
connections = {}
122
122
for connection_setting in connection_settings :
123
123
alias = connection_setting .setdefault (
124
- "alias" , mongoengine .DEFAULT_CONNECTION_NAME
124
+ "alias" ,
125
+ mongoengine .DEFAULT_CONNECTION_NAME ,
125
126
)
127
+ connection_setting .setdefault ("uuidRepresentation" , "standard" )
126
128
connections [alias ] = mongoengine .connect (** connection_setting )
127
129
128
130
return connections
Original file line number Diff line number Diff line change @@ -38,7 +38,15 @@ def app() -> Flask:
38
38
39
39
@pytest .fixture ()
40
40
def 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
+ ]
42
50
test_db = MongoEngine (app )
43
51
db_name = (
44
52
test_db .connection ["default" ].get_database ("flask_mongoengine_test_db" ).name
Original file line number Diff line number Diff line change 7
7
@pytest .fixture ()
8
8
def extended_db (app ):
9
9
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
+ ]
11
19
test_db = MongoEngine (app )
12
20
db_name = (
13
21
test_db .connection ["default" ].get_database ("flask_mongoengine_test_db" ).name
You can’t perform that action at this time.
0 commit comments