get_mongodb_version tests helper + fix indexing tests in mongodb v2.4

This commit is contained in:
Stefan Wojcik
2017-02-25 20:21:20 -05:00
parent d39f5197cb
commit 71ccfeac3c
4 changed files with 23 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
import unittest
from mongoengine import connect
from mongoengine.connection import get_db
from mongoengine.connection import get_db, get_connection
MONGO_TEST_DB = 'mongoenginetest'
@@ -20,3 +20,10 @@ class MongoDBTestCase(unittest.TestCase):
@classmethod
def tearDownClass(cls):
cls._connection.drop_database(MONGO_TEST_DB)
def get_mongodb_version():
"""Return the version tuple of the MongoDB server that the default
connection is connected to.
"""
return get_connection().server_info()['versionArray']