Ejemplo n.º 1
0
def _removedb(netdir, address_hex):
    user_db_dir = os.path.join(netdir, address_hex[:8]) if address_hex else netdir

    if not os.path.exists(user_db_dir):
        return False

    # Sanity check if the specified directory is a Raiden datadir.
    sane = True
    if not address_hex:
        ls = os.listdir(user_db_dir)
        sane = all(
            is_minified_address(f) and
            len(f) == 8 and
            os.path.isdir(os.path.join(user_db_dir, f))
            for f in ls
        )

    if not sane:
        print('WARNING: The specified directory does not appear to be a Raiden data directory.')

    prompt = 'Are you sure you want to delete {}?'.format(user_db_dir)

    if click.confirm(prompt):
        shutil.rmtree(user_db_dir)
        print('Local data deleted.')
    else:
        print('Aborted.')

    return True
Ejemplo n.º 2
0
def _removedb(netdir, address_hex):
    user_db_dir = os.path.join(netdir,
                               address_hex[:8]) if address_hex else netdir

    if not os.path.exists(user_db_dir):
        return False

    # Sanity check if the specified directory is a Raiden datadir.
    sane = True
    if not address_hex:
        ls = os.listdir(user_db_dir)
        sane = all(
            is_minified_address(f) and len(f) == 8
            and os.path.isdir(os.path.join(user_db_dir, f)) for f in ls)

    if not sane:
        print(
            'WARNING: The specified directory does not appear to be a Raiden data directory.'
        )

    prompt = 'Are you sure you want to delete {}?'.format(user_db_dir)

    if click.confirm(prompt):
        shutil.rmtree(user_db_dir)
        print('Local data deleted.')
    else:
        print('Aborted.')

    return True
Ejemplo n.º 3
0
def test_minified_address_checker():
    assert is_minified_address('9bed7fd1')
    assert is_minified_address('8c1d1f23')
    assert not is_minified_address('xxxxxx')
    assert not is_minified_address('123zzz')
    assert not is_minified_address('$@$^$')
Ejemplo n.º 4
0
def test_minified_address_checker():
    assert is_minified_address('9bed7fd1')
    assert is_minified_address('8c1d1f23')
    assert not is_minified_address('xxxxxx')
    assert not is_minified_address('123zzz')
    assert not is_minified_address('$@$^$')
Ejemplo n.º 5
0
def test_minified_address_checker():
    assert is_minified_address("9bed7fd1")
    assert is_minified_address("8c1d1f23")
    assert not is_minified_address("xxxxxx")
    assert not is_minified_address("123zzz")
    assert not is_minified_address("$@$^$")