def test_01__get_config_param(self, config_obj=CONF_OBJ_DICT, param_name="backend"): # Try get not existing configuration parameter conf = InventoryConfiguration() self.assertRaises(BIException, conf._get_config_param, CONF_OBJ_DICT, "fake_param_name") # Get configuration parameter result = conf._get_config_param(CONF_OBJ_DICT, "backend") self.assertEqual(result, "mongodb")
def test_02_get_backend_db(self, config_file="/blik-ri-conf.yaml"): conf = InventoryConfiguration() # Use wrong path to configuration file self.assertRaises(Exception, conf.get_backend_db, "/some/fake/path/to.file") # Use wrong configuration file syntax self.assertRaises(Exception, conf.get_backend_db, "./tests/wrong-blik-ri-conf.yaml") # Use wrong backend configuration parameter self.assertRaises(Exception, conf.get_backend_db, "./tests/wrong-blik-ri-conf_2.yaml") # Use wrong path to configuration file conn_obj = conf.get_backend_db("./blik/inventory/conf/blik-ri-conf.yaml.example") self.assertEqual(isinstance(conn_obj, object), True)