Merge branch 'master' of http://github.com/vandersonmota/mongoengine into v0.4
This commit is contained in:
commit
ba01817ee3
21
mongoengine/django/tests.py
Normal file
21
mongoengine/django/tests.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#coding: utf-8
|
||||||
|
from django.test import TestCase
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
from mongoengine import connect
|
||||||
|
|
||||||
|
class MongoTestCase(TestCase):
|
||||||
|
"""
|
||||||
|
TestCase class that clear the collection between the tests
|
||||||
|
"""
|
||||||
|
db_name = 'test_%s' % settings.MONGO_DATABASE_NAME
|
||||||
|
def __init__(self, methodName='runtest'):
|
||||||
|
self.db = connect(self.db_name)
|
||||||
|
super(MongoTestCase, self).__init__(methodName)
|
||||||
|
|
||||||
|
def _post_teardown(self):
|
||||||
|
super(MongoTestCase, self)._post_teardown()
|
||||||
|
for collection in self.db.collection_names():
|
||||||
|
if collection == 'system.indexes':
|
||||||
|
continue
|
||||||
|
self.db.drop_collection(collection)
|
Loading…
x
Reference in New Issue
Block a user