def test_load_default_headers_defined_at_child_level_only(): config = BdkConfigLoader.load_from_file(get_config_resource_filepath("config_headers_child_only.yaml")) assert config.default_headers is None assert config.pod.default_headers is None assert config.key_manager.default_headers is None assert config.session_auth.default_headers is None assert config.agent.default_headers == {"user-agent": "custom-user-agent", "header-key": "header-value"}
def test_datafeed_retry_configuration(): config_path = get_config_resource_filepath("datafeed_retry_config.yaml") config = BdkConfigLoader.load_from_file(config_path) assert config.datafeed.retry.max_attempts == 2 assert config.datafeed.retry.initial_interval.total_seconds() == 1.0 assert config.datafeed.retry.multiplier == 3 assert config.datafeed.retry.max_interval.total_seconds() == 2.0
def test_load_default_headers_defined_at_global_and_child_level(): global_headers = {"user-agent": "global-user-agent", "header-key": "global-header-value"} config = BdkConfigLoader.load_from_file(get_config_resource_filepath("config_headers_global_child.yaml")) assert config.default_headers == global_headers assert config.pod.default_headers == global_headers assert config.key_manager.default_headers == global_headers assert config.session_auth.default_headers == global_headers assert config.agent.default_headers == {"user-agent": "agent-user-agent", "header-key": "agent-header-value"}
def test_load_proxy_defined_at_global_level(): config = BdkConfigLoader.load_from_file(get_config_resource_filepath("config_global_proxy.yaml")) assert config.proxy.host == "proxy.symphony.com" assert config.proxy.port == 1234 assert config.proxy.username == "proxyuser" assert config.proxy.password == "proxypass" assert config.agent.proxy == config.proxy assert config.pod.proxy == config.proxy assert config.key_manager.proxy == config.proxy assert config.session_auth.proxy == config.proxy
def test_load_proxy_defined_at_child_level_only(): config = BdkConfigLoader.load_from_file(get_config_resource_filepath("config_proxy_child_only.yaml")) assert config.proxy is None assert config.pod.proxy is None assert config.key_manager.proxy is None assert config.session_auth.proxy is None assert config.agent.proxy.host == "agent-proxy.symphony.com" assert config.agent.proxy.port == 5678 assert config.agent.proxy.username is None assert config.agent.proxy.password is None
def test_default_retry_configuration(): config_path = get_config_resource_filepath("config.yaml") config = BdkConfigLoader.load_from_file(config_path) assert config.retry.max_attempts == BdkRetryConfig.DEFAULT_MAX_ATTEMPTS assert config.retry.initial_interval == timedelta( milliseconds=BdkRetryConfig.DEFAULT_INITIAL_INTERVAL) assert config.retry.multiplier == BdkRetryConfig.DEFAULT_MULTIPLIER assert config.retry.max_interval == timedelta( milliseconds=BdkRetryConfig.DEFAULT_MAX_INTERVAL) # Datafeed default retry assert config.datafeed.retry.max_attempts == sys.maxsize assert config.datafeed.retry.initial_interval == timedelta( milliseconds=BdkRetryConfig.DEFAULT_INITIAL_INTERVAL) assert config.datafeed.retry.multiplier == BdkRetryConfig.DEFAULT_MULTIPLIER assert config.datafeed.retry.max_interval == timedelta( milliseconds=BdkRetryConfig.DEFAULT_MAX_INTERVAL)
def fixture_app_cert_config(): return BdkConfigLoader.load_from_file(get_config_resource_filepath("config_obo_cert.yaml"))
def fixture_simple_config_path(request): return get_config_resource_filepath(request.param)
def fixture_config(): config = BdkConfigLoader.load_from_file(get_config_resource_filepath("config.yaml")) return config
def fixture_invalid_config_path(request): return get_config_resource_filepath(request.param)
def test_parse_config_yaml(): config_path = get_config_resource_filepath("config.yaml") with open(config_path) as yaml_file: config_data = BdkConfigParser.parse(yaml_file.read()) assert config_data["bot"]["username"] == "youbot"
def test_parse_config_json(): config_path = get_config_resource_filepath("config.json") with open(config_path) as json_file: config_data = BdkConfigParser.parse(json_file.read()) assert config_data["bot"]["username"] == "youbot"
def fixture_config(): config = BdkConfigLoader.load_from_file(get_config_resource_filepath("config.yaml")) config.datafeed.retry = minimal_retry_config() config.datafeed.version = "v2" return config
def fixture_global_config_path(request): return get_config_resource_filepath(request.param)