def test_get_configuration_from_dictionary(): """Pass a dictionary of desired values to get_config Tests that values are found for all these configuration keys They will have non-zero length string values so long as they are have default values in config.yaml and/or are configured in the .env""" configuration = { "SERVER_HOST": None, "SERVER_PORT": None, "VALIDATOR_HOST": None, "VALIDATOR_PORT": None, "TIMEOUT": None, "VALIDATOR_REST_HOST": None, "VALIDATOR_REST_PORT": None, "DB_HOST": None, "DB_PORT": None, "DB_NAME": None, "SECRET_KEY": None, "AES_KEY": None, "ADFASERDXS": None, } get_config(configuration) value = configuration["VALIDATOR_HOST"] assert value and isinstance(value, str) value = configuration["VALIDATOR_HOST"] assert value and isinstance(value, str) value = configuration["VALIDATOR_PORT"] assert value and isinstance(value, str) value = configuration["SERVER_HOST"] assert value and isinstance(value, str) value = configuration["SERVER_PORT"] assert value and isinstance(value, str) value = configuration["VALIDATOR_HOST"] assert value and isinstance(value, str) value = configuration["VALIDATOR_PORT"] assert value and isinstance(value, str) value = configuration["TIMEOUT"] assert value and isinstance(value, str) value = configuration["VALIDATOR_REST_HOST"] assert value and isinstance(value, str) value = configuration["VALIDATOR_REST_PORT"] assert value and isinstance(value, str) value = configuration["DB_HOST"] assert value and isinstance(value, str) value = configuration["DB_PORT"] assert value and isinstance(value, str) value = configuration["DB_NAME"] assert value and isinstance(value, str) value = configuration["SECRET_KEY"] assert value and isinstance(value, str) value = configuration["AES_KEY"] assert value and isinstance(value, str) value = configuration["ADFASERDXS"] assert value is None
def test_get_config(): """Pass a key values of desired value to get_config Tests that values are found for all these configuration keys They will have non-zero length string values so long as they are have default values in config.yaml and/or are configured in the .env""" value = get_config("VALIDATOR_HOST") assert value and isinstance(value, str) value = get_config("VALIDATOR_HOST") assert value and isinstance(value, str) value = get_config("VALIDATOR_PORT") assert value and isinstance(value, str) value = get_config("SERVER_HOST") assert value and isinstance(value, str) value = get_config("SERVER_PORT") assert value and isinstance(value, str) value = get_config("VALIDATOR_HOST") assert value and isinstance(value, str) value = get_config("VALIDATOR_PORT") assert value and isinstance(value, str) value = get_config("TIMEOUT") assert value and isinstance(value, str) value = get_config("VALIDATOR_REST_HOST") assert value and isinstance(value, str) value = get_config("VALIDATOR_REST_PORT") assert value and isinstance(value, str) value = get_config("DB_HOST") assert value and isinstance(value, str) value = get_config("DB_PORT") assert value and isinstance(value, str) value = get_config("DB_NAME") assert value and isinstance(value, str) value = get_config("SECRET_KEY") assert value and isinstance(value, str) value = get_config("AES_KEY") assert value and isinstance(value, str) value = get_config("ADFASERDXS") assert value is None