Best Python code snippet using pandera_python
main.py
Source:main.py
1from duoauthproxy.lib.validation.config.check import base2from duoauthproxy.lib.validation.config.config_results import MissingKey3from duoauthproxy.lib.validation.config.config_toolbox import STANDARD_CONFIG_TOOLBOX4from duoauthproxy.lib.validation.connectivity.connectivity_results import (5 ConfigCheckResult,6)7def check_main(config, toolbox=STANDARD_CONFIG_TOOLBOX):8 """9 Validates the [main] section of the auth proxy config.10 Args:11 config (ConfigDict): The radius server auto config to check12 toolbox (ConfigTestToolbox): Toolbox used to execute the tests13 Returns:14 ConfigCheckResult containing any configuration errors15 """16 problems = check_config_values(config, toolbox)17 problems += check_config_dependencies(config)18 return ConfigCheckResult(problems)19def check_config_values(config, toolbox):20 """ Validates the values for provided config in the [main] section21 Args:22 config (ConfigDict): The config object to check the optional config for23 toolbox (ConfigTestToolbox): Toolbox used to execute the tests24 Returns:25 list of BaseResult26 """27 config_test_resolver = {28 "debug": toolbox.test_is_bool,29 "log_dir": toolbox.test_is_valid_directory,30 "log_auth_events": toolbox.test_is_bool,31 "log_sso_events": toolbox.test_is_bool,32 "log_max_files": toolbox.test_is_positive_int,33 "log_max_size": toolbox.test_is_positive_int,34 "log_file": toolbox.test_is_bool,35 "log_stdout": toolbox.test_is_bool,36 "log_syslog": toolbox.test_is_bool,37 "syslog_facility": toolbox.test_is_string,38 "http_ca_certs_file": toolbox.test_file_readable,39 "interface": toolbox.test_is_valid_single_ip,40 "http_proxy_host": toolbox.test_is_string,41 "http_proxy_port": toolbox.test_valid_port,42 "test_connectivity_on_startup": toolbox.test_is_bool,43 "client": toolbox.test_is_string,44 "fips_mode": toolbox.test_is_bool,45 "server": toolbox.test_is_string,46 }47 problems = base.run_config_value_checks(config, config_test_resolver)48 problems += base.check_for_unexpected_keys(config, toolbox, config_test_resolver)49 return problems50def check_config_dependencies(config):51 """ Validates dependencies between config options within an [main] section52 Args:53 config (ConfigDict): The config object to validate dependencies on54 Returns:55 list of ConfigResults56 """57 problems = []58 if "http_proxy_port" in config and "http_proxy_host" not in config:59 problems.append(MissingKey(key="http_proxy_host"))...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!