def test_16_edit(config): newval = "a new life for B" config.store_value_to_db("B", newval) assert config.modified # update config dict from biothings.utils.hub_db import get_hub_config d = get_hub_config().find_one({"_id": "B"}) assert d["json"] == json.dumps(newval) assert config.show()["scope"]["config"]["B"]["value"] == newval
def setUp(self): import conf_base # reload as config manager may delete some params import importlib importlib.reload(conf_base) conf_base.HUB_DB_BACKEND = { "module": "biothings.utils.mongo", "uri": "mongodb://su05:27017" } # mandatory for conf_base.DATA_HUB_DB_DATABASE = "unittest_config" # simulaye config param set at runtime, not from config files conf_base.DYNPARAM = "runtime" import biothings biothings.config_for_app(conf_base) from biothings import config self.confobj = config self.config = self.confobj.show()["scope"]["config"] from biothings.utils.hub_db import get_hub_config self.hub_config = get_hub_config()
def tearDown(self): from biothings.utils.hub_db import get_hub_config get_hub_config().drop()