Skip to content

An extension to the Django web framework that provides testing support for mongoengine dependent modules.

License

Notifications You must be signed in to change notification settings

snormore/django-mongotesting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-mongotesting

An extension to the Django web framework that provides testing support for mongoengine dependent modules.

See http://nubits.org/post/testing-with-django-and-mongoengine/

Requirements

  • Django 1.2+
  • MongoEngine

Usage

First, define MONGO_DATABASES and MONGO_PORT settings. Including the mongo connection bit, you should have something like this in your settings.py file:

MONGO_DATABASES = {
    # db_name, db_alias
    'dbname': 'alias', 
}
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
import mongoengine
for db_name, db_alias in MONGO_DATABASES.keys():
    mongoengine.connect(db_name, host=MONGO_HOST, port=MONGO_PORT)

If you would like a test mongo db created and destroyed for each test method in a class then inherit the MongoTestCase class from the mongotesting module.

If you would like a test mongo db created and destroyed for each test class, then define the TEST_RUNNER setting to use MongoTestRunner, as follows:

TEST_RUNNER = 'mongotesting.MongoTestRunner'

Reference

About

An extension to the Django web framework that provides testing support for mongoengine dependent modules.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages