Ejemplo n.º 1
0
def main(usermaps):

    loaded = {path: load(path) for path in usermaps}
    sync_all(loaded.values())
    for path, value in loaded.items():
        dump(value, path)

    mapstats(loaded.items())
def test_usermap_sync(tmppath):

    dump({'test': None}, tmppath/'a.json')

    dump({'test': 'a', 'bad': 'b'}, tmppath/'b.json')

    runner = CliRunner()
    result = runner.invoke(main, [
        str(tmppath/'a.json'),
        str(tmppath/'b.json'),
    ], catch_exceptions=False)
    assert result.exit_code == 0

    assert load(tmppath/'a.json') == {'test': 'a'}
def test_usermap_sync(tmppath):

    dump({'test': None}, tmppath / 'a.json')

    dump({'test': 'a', 'bad': 'b'}, tmppath / 'b.json')

    runner = CliRunner()
    result = runner.invoke(main, [
        str(tmppath / 'a.json'),
        str(tmppath / 'b.json'),
    ],
                           catch_exceptions=False)
    assert result.exit_code == 0

    assert load(tmppath / 'a.json') == {'test': 'a'}