from dtsdance.dflow import DFlowHelper
from dtsdance.bytecloud import ByteCloudEnvInfo, ByteCloudHelper

from config import load_config

config = load_config()
envs_bytecloud = {k: ByteCloudEnvInfo(k, v["endpoint"], v["svc_secret"]) for k, v in config["sites"].items()}
bytecloud_helper = ByteCloudHelper(envs_bytecloud)
dsyncer_helper = DFlowHelper(bytecloud_helper)


# pytest tests/test_dflow.py::test_get_dflow_info -s
def test_get_dflow_info():
    try:
        info = dsyncer_helper.get_dflow_info("boe", "1324653150464")
        # info = dsyncer_helper.get_dflow_info("i18n-bd", "4102917472017")
        # info = dsyncer_helper.get_dflow_info("us-ttp", "257993088799750")
        # info = dsyncer_helper.get_dflow_info("eu-ttp", "815571859216")
        print(f"DFlow Info: {info}")
    except Exception as e:
        print(f"Failed to get DFlow info for environment boe: {e}")
