Prevent accessing not yet configured settings in django.MongoTestCase

This commit is contained in:
Aleksey Porfirov 2014-07-05 00:06:10 +04:00
parent b2a2735034
commit 0d81e7933e

View File

@ -26,7 +26,11 @@ class MongoTestCase(TestCase):
""" """
TestCase class that clear the collection between the tests TestCase class that clear the collection between the tests
""" """
db_name = 'test_%s' % settings.MONGO_DATABASE_NAME
@property
def db_name(self):
return 'test_%s' % settings.MONGO_DATABASE_NAME
def __init__(self, methodName='runtest'): def __init__(self, methodName='runtest'):
self.db = connect(self.db_name).get_db() self.db = connect(self.db_name).get_db()
super(MongoTestCase, self).__init__(methodName) super(MongoTestCase, self).__init__(methodName)