コード例 #1
0
ファイル: test_config.py プロジェクト: qwcode/qwcore
def test_get_key_success(monkeypatch):
    def get_config(appname):
        return {'section': {'key': 'value'}}

    monkeypatch.setattr('qwcore.config.get_config', get_config)
    config.get_value('app', 'key', section='section',
                     default='default') == 'value'
コード例 #2
0
ファイル: test_config.py プロジェクト: qwcode/qwcore
def test_get_key_key_not_found(monkeypatch):
    def get_config(appname):
        return {'section': {}}

    monkeypatch.setattr('qwcore.config.get_config', get_config)
    with pytest.raises(exception.ConfigFileKeyNotFoundError):
        config.get_value('app', 'key', section='section')
コード例 #3
0
ファイル: test_config.py プロジェクト: qwcode/qwcore
def test_get_key_key_not_found_default(monkeypatch):
    def get_config(appname):
        return {'section': {}}

    monkeypatch.setattr('qwcore.config.get_config', get_config)
    config.get_value('app', 'key', section='section',
                     default='default') == 'default'
コード例 #4
0
ファイル: test_config.py プロジェクト: qwcode/qwcore
def test_get_key_config_not_found(monkeypatch):
    def get_config(appname):
        raise exception.ConfigFileNotFoundError()

    monkeypatch.setattr('qwcore.config.get_config', get_config)
    with pytest.raises(exception.ConfigFileNotFoundError):
        config.get_value('app', 'key')
コード例 #5
0
ファイル: test_config.py プロジェクト: qwcode/qwcore
def test_get_key_config_not_found_default(monkeypatch):
    def get_config(appname):
        raise exception.ConfigFileNotFoundError()

    monkeypatch.setattr('qwcore.config.get_config', get_config)
    config.get_value('app', 'key', default='default') == 'default'
コード例 #6
0
ファイル: test_config.py プロジェクト: qwcode/qwcore
def test_get_key_success(monkeypatch):
    def get_config(appname):
        return {'section': {'key': 'value'}}
    monkeypatch.setattr('qwcore.config.get_config', get_config)
    config.get_value('app', 'key', section='section', default='default') == 'value'
コード例 #7
0
ファイル: test_config.py プロジェクト: qwcode/qwcore
def test_get_key_key_not_found_default(monkeypatch):
    def get_config(appname):
        return {'section': {}}
    monkeypatch.setattr('qwcore.config.get_config', get_config)
    config.get_value('app', 'key', section='section', default='default') == 'default'
コード例 #8
0
ファイル: test_config.py プロジェクト: qwcode/qwcore
def test_get_key_key_not_found(monkeypatch):
    def get_config(appname):
        return {'section': {}}
    monkeypatch.setattr('qwcore.config.get_config', get_config)
    with pytest.raises(exception.ConfigFileKeyNotFoundError):
        config.get_value('app', 'key', section='section')
コード例 #9
0
ファイル: test_config.py プロジェクト: qwcode/qwcore
def test_get_key_config_not_found_default(monkeypatch):
    def get_config(appname):
        raise exception.ConfigFileNotFoundError()
    monkeypatch.setattr('qwcore.config.get_config', get_config)
    config.get_value('app', 'key', default='default') == 'default'
コード例 #10
0
ファイル: test_config.py プロジェクト: qwcode/qwcore
def test_get_key_config_not_found(monkeypatch):
    def get_config(appname):
        raise exception.ConfigFileNotFoundError()
    monkeypatch.setattr('qwcore.config.get_config', get_config)
    with pytest.raises(exception.ConfigFileNotFoundError):
        config.get_value('app', 'key')