2.9. Use mongomock for testingΒΆ

mongomock is a package to do just what the name implies, mocking a mongo database.

To use with mongoengine, simply specify mongomock when connecting with mongoengine:

connect('mongoenginetest', host='mongomock://localhost')
conn = get_connection()

or with an alias:

connect('mongoenginetest', host='mongomock://localhost', alias='testdb')
conn = get_connection('testdb')
Read the Docs v: latest
Versions
latest
stable
Downloads
pdf
htmlzip
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.