Example #1
0
def test_internal_fru_file_not_found():
    path = os.path.join(
        os.path.dirname(__file__),
        'internal-fru-file-not-found.ini'
    )
    with pytest.raises(ValueError) as error:
        fru.read_config(path)
        assert 'not found' in error.msg
Example #2
0
def test_identical_loading(name):
    path = os.path.join(os.path.dirname(__file__), 'basic-{}.ini'.format(name))
    ini_data = fru.read_config(path)

    path = os.path.join(os.path.dirname(__file__), 'basic-{}.bin'.format(name))
    bin_data = fru.load(path=path)

    assert ini_data == bin_data
Example #3
0
def test_basic_ini_sections(name):
    path = os.path.join(os.path.dirname(__file__), 'basic-{}.ini'.format(name))
    config = fru.read_config(path)
    actual = fru.dump(config)

    path = os.path.join(os.path.dirname(__file__), 'basic-{}.bin'.format(name))
    with open(path, 'rb') as f:
        expected = f.read()

    assert actual == expected
Example #4
0
def test_skipped_section():
    path = os.path.join(os.path.dirname(__file__), 'skip-section.ini')
    config = fru.read_config(path)
    assert "internal" not in config
Example #5
0
def test_internal_fru_requested_but_empty():
    path = os.path.join(os.path.dirname(__file__), 'internal-empty.ini')
    data = fru.read_config(path)
    assert 'internal' not in data