-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add mongomock if app.config['TESTING'] #98
Comments
+1 |
2 similar comments
+1 |
+1 |
I will be looking into adding this to the milestone. Thanks |
Target
|
@losintikfos why not use mongomock like mongo engine? The problem is the current version of mongo engine (0.10.5) doens't support it yet. But the next version (0.10.6) will. What do you think about? |
@brunobelarmino so similarly to MongoEngine - check for the connection string protocol construct instead of the app.config['TESTING'] setting? |
@losintikfos IMHO it is the better solution. 😄 let me know yours. |
@brunobelarmino I did not patronise nor pooped your suggestion. I was enquiring for confirmation to ensure you meant avoid using setting Your solution might be best to you but not to others. |
Sorry whether my message seems selfish. But it isnt the intention. I think flask-mongoengine shouldnt decide whats the best way to test apps. For example: create a mongod instance, use a existing mongod instance or use mongomock. I think the best solution is turn flask-mongoengine flexible and working with all this approaches. But my point is today flask-mongoengine doesnt work with mongomock. I Think when the app.config['TESTING'] is true we could by pass de pymongo uri validation. Additionally would be nice have a default approach to use when neither of the others is defined. |
@brunobelarmino agree +1 |
Fixed in master. @brunobelarmino, @ocean1, time to give it a try before the release ships. |
Is there any word for adding back support for MongoMock in? I saw it was removed in 2bb06df, but for a lot of people this could be a deal breaker for using flask and mongo who want to write good unittests. |
Hi @jzarob - I've been able to get things to work with pytest, flask-mongoengine and mongomock by adding this to my
This overloads the environment settings for when |
Hi @LaundroMat, could you provide more details? Perhaps your |
Well, the only relevant code in
You also need to include
|
Thank you, @LaundroMat! Turns out my problem was I had not imported the main 'app' nor included the fixture as a parameter like you mentioned, so the database was never configured. |
Hi, |
i would love to be able to have a mongomock connection if app.config['TESTING'] is true
this would allow easier testing of the flask application (otherwise an in-memory mongo like the one implemented in ming would be great)
The text was updated successfully, but these errors were encountered: