コード例 #1
0
def test_ConfigOSEnv():
    os.environ["EVERETT_TEST_FOO"] = "bar"
    os.environ["EVERETT_TEST_FOO"] = "bar"
    cose = ConfigOSEnv()

    assert cose.get("everett_test_foo") == "bar"
    assert cose.get("EVERETT_test_foo") == "bar"
    assert cose.get("foo", namespace=["everett", "test"]) == "bar"
コード例 #2
0
def test_ConfigOSEnv():
    os.environ['EVERETT_TEST_FOO'] = 'bar'
    os.environ['EVERETT_TEST_FOO'] = 'bar'
    cose = ConfigOSEnv()

    assert cose.get('everett_test_foo') == 'bar'
    assert cose.get('EVERETT_test_foo') == 'bar'
    assert cose.get('foo', namespace=['everett', 'test']) == 'bar'
コード例 #3
0
ファイル: test_manager.py プロジェクト: willkg/everett
def test_ConfigOSEnv():
    os.environ['EVERETT_TEST_FOO'] = 'bar'
    os.environ['EVERETT_TEST_FOO'] = 'bar'
    cose = ConfigOSEnv()

    assert cose.get('everett_test_foo') == 'bar'
    assert cose.get('EVERETT_test_foo') == 'bar'
    assert cose.get('foo', namespace=['everett', 'test']) == 'bar'
コード例 #4
0
ファイル: test_manager.py プロジェクト: pmac/everett
def test_ConfigOSEnv():
    with mock.patch('os.environ') as os_environ_mock:
        os_environ_mock.__contains__.return_value = True
        os_environ_mock.__getitem__.return_value = 'baz'
        cose = ConfigOSEnv()
        assert cose.get('foo') == 'baz'
        os_environ_mock.__getitem__.assert_called_with('FOO')

    with mock.patch('os.environ') as os_environ_mock:
        os_environ_mock.__contains__.return_value = True
        os_environ_mock.__getitem__.return_value = 'baz'
        cose = ConfigOSEnv()
        assert cose.get('foo', namespace=['a']) == 'baz'
        os_environ_mock.__getitem__.assert_called_with('A_FOO')