Exemplo n.º 1
0
def test_ConfigEnvFileEnv(datadir):
    env_filename = os.path.join(datadir, ".env")
    cefe = ConfigEnvFileEnv(["/does/not/exist/.env", env_filename])
    assert cefe.get("not_a", namespace="youre") == "golfer"
    assert cefe.get("loglevel") == "walter"
    assert cefe.get("LOGLEVEL") == "walter"
    assert cefe.get("missing") is NO_VALUE
    assert cefe.data == {
        "LOGLEVEL": "walter",
        "DEBUG": "True",
        "YOURE_NOT_A": "golfer",
        "DATABASE_URL": "sqlite:///kahlua.db",
    }

    cefe = ConfigEnvFileEnv(env_filename)
    assert cefe.get("not_a", namespace="youre") == "golfer"

    cefe = ConfigEnvFileEnv("/does/not/exist/.env")
    assert cefe.get("loglevel") is NO_VALUE
Exemplo n.º 2
0
def test_ConfigEnvFileEnv(datadir):
    env_filename = os.path.join(datadir, '.env')
    cefe = ConfigEnvFileEnv(['/does/not/exist/.env', env_filename])
    assert cefe.get('not_a', namespace='youre') == 'golfer'
    assert cefe.get('loglevel') == 'walter'
    assert cefe.get('LOGLEVEL') == 'walter'
    assert cefe.get('missing') is NO_VALUE
    assert cefe.data == {
        'LOGLEVEL': 'walter',
        'DEBUG': 'True',
        'YOURE_NOT_A': 'golfer',
        'DATABASE_URL': 'sqlite:///kahlua.db',
    }

    cefe = ConfigEnvFileEnv(env_filename)
    assert cefe.get('not_a', namespace='youre') == 'golfer'

    cefe = ConfigEnvFileEnv('/does/not/exist/.env')
    assert cefe.get('loglevel') is NO_VALUE
Exemplo n.º 3
0
def test_ConfigEnvFileEnv(datadir):
    env_filename = os.path.join(datadir, '.env')
    cefe = ConfigEnvFileEnv(['/does/not/exist/.env', env_filename])
    assert cefe.get('not_a', namespace='youre') == 'golfer'
    assert cefe.get('loglevel') == 'walter'
    assert cefe.get('LOGLEVEL') == 'walter'
    assert cefe.get('missing') is NO_VALUE
    assert cefe.data == {
        'LOGLEVEL': 'walter',
        'DEBUG': 'True',
        'YOURE_NOT_A': 'golfer',
        'DATABASE_URL': 'sqlite:///kahlua.db',
    }

    cefe = ConfigEnvFileEnv(env_filename)
    assert cefe.get('not_a', namespace='youre') == 'golfer'

    cefe = ConfigEnvFileEnv('/does/not/exist/.env')
    assert cefe.get('loglevel') is NO_VALUE