Esempio n. 1
0
def test_extract_info_dir():
    simple_fs = {'a': {'b.yaml': 'meta: [{foo: c}]'}}
    _, _, fake_isdir, fake_open = make_fake_fstools(simple_fs)
    info = extract_info('a', [], fake_isdir, fake_open)
    assert info == {}

    info = extract_info('a', ['foo', 'bar'], fake_isdir, fake_open)
    assert info == {'foo': '', 'bar': ''}

    info = extract_info('a/b.yaml', ['foo', 'bar'], fake_isdir, fake_open)
    assert info == {'foo': 'c', 'bar': ''}
def test_extract_info_dir():
    simple_fs = {'a': {'b.yaml': 'meta: [{foo: c}]'}}
    _, _, fake_isdir, fake_open = make_fake_fstools(simple_fs)
    info = extract_info('a', [], fake_isdir, fake_open)
    assert info == {}

    info = extract_info('a', ['foo', 'bar'], fake_isdir, fake_open)
    assert info == {'foo': '', 'bar': ''}

    info = extract_info('a/b.yaml', ['foo', 'bar'], fake_isdir, fake_open)
    assert info == {'foo': 'c', 'bar': ''}
def test_extract_info_dir(m_isdir, m_open):
    simple_fs = {'a': {'b.yaml': 'meta: [{foo: c}]'}}
    _, _, _, m_isdir.side_effect, m_open.side_effect = \
        make_fake_fstools(simple_fs)
    info = extract_info('a', [])
    assert info == {}

    info = extract_info('a', ['foo', 'bar'])
    assert info == {'foo': '', 'bar': ''}

    info = extract_info('a/b.yaml', ['foo', 'bar'])
    assert info == {'foo': 'c', 'bar': ''}
def test_extract_info_empty_file():
    simple_fs = {'a.yaml': ''}
    _, _, fake_isdir, fake_open = make_fake_fstools(simple_fs)
    info = extract_info('a.yaml', [], fake_isdir, fake_open)
    assert info == {}
def check_parse_error(fs):
    _, _, fake_isdir, fake_open = make_fake_fstools(fs)
    with pytest.raises(ParseError):
        a = extract_info('a.yaml', ['a'], fake_isdir, fake_open)
        raise Exception(str(a))
def test_extract_info_empty_file(m_isdir, m_open):
    simple_fs = {'a.yaml': ''}
    _, _, _, m_isdir.side_effect, m_open.side_effect = \
        make_fake_fstools(simple_fs)
    info = extract_info('a.yaml', [])
    assert info == {}
def check_parse_error(fs, m_isdir, m_open):
    _, _, _, m_isdir.side_effect, m_open.side_effect = make_fake_fstools(fs)
    with pytest.raises(ParseError):
        a = extract_info('a.yaml', ['a'])
        raise Exception(str(a))
Esempio n. 8
0
def test_extract_info_empty_file():
    simple_fs = {'a.yaml': ''}
    _, _, fake_isdir, fake_open = make_fake_fstools(simple_fs)
    info = extract_info('a.yaml', [], fake_isdir, fake_open)
    assert info == {}
Esempio n. 9
0
def check_parse_error(fs):
    _, _, fake_isdir, fake_open = make_fake_fstools(fs)
    with pytest.raises(ParseError):
        a = extract_info('a.yaml', ['a'], fake_isdir, fake_open)
        raise Exception(str(a))