def test_custom_config_prefix(self):
self.app.config['CUSTOM_DBNAME'] = 'flask_pymongo_test_db'
self.app.config['CUSTOM_HOST'] = 'localhost'
self.app.config['CUSTOM_PORT'] = 27017
mongo = flask.ext.pymongo.PyMongo(self.app, 'CUSTOM')
assert mongo.db.name == 'flask_pymongo_test_db', 'wrong dbname: %s' % mongo.db.name
if pymongo.version_tuple[0] > 2:
time.sleep(0.2)
assert ('localhost', 27017) == mongo.cx.address
else:
assert mongo.cx.host == 'localhost'
assert mongo.cx.port == 27017
评论列表
文章目录