def test_sync_tool(tmpdir):
    # test non-existing destination
    try:
        _SyncTool(client, 'should-not-exist', None, None, None)
    except __HOLE__ as ve:
        assert str(ve) == 'destination must exist and be a directory'

    # test existing destination, no aoi.geojson
    td = tmpdir.mkdir('sync-dest')
    try:
        _SyncTool(client, td.strpath, None, None, None)
    except ValueError as ve:
        assert str(ve) == 'no aoi provided and no aoi.geojson file'

    # test existing destination, invalid aoi.geojson
    aoi_file = td.join('aoi.geojson')
    aoi_file.write('not geojson')
    try:
        _SyncTool(client, td.strpath, None, None, None)
    except ValueError as ve:
        assert str(ve) == '%s does not contain valid JSON' % aoi_file

    td.remove(True)
dataset/ETHPy150Open planetlabs/planet-client-python/tests/test_sync.py/test_sync_tool