Exemplo n.º 1
0
def test_update_echo(echo_path):
    u = Updater(str(echo_path))
    u.start()

    while not u.is_done():
        time.sleep(1)

    assert u.has_error()
    assert u.state() == UpdaterState.ERROR
Exemplo n.º 2
0
def test_update_appimaged_progress(appimaged_path, tmpdir):
    test_dir = tmpdir.mkdir("test_update_appimaged")

    # need to copy appimaged to another directory
    # as libappimageupdate will update the file in-place (i.e., create a file
    # next to the original file), we need to copy appimaged to the temporary
    # directory and update it there
    new_appimaged_path = test_dir.join("appimaged.AppImage")
    shutil.copyfile(appimaged_path, new_appimaged_path)

    u = Updater(str(new_appimaged_path))

    u.start()

    while not u.is_done():
        assert u.progress() >= 0
        time.sleep(1)
        assert u.progress() <= 1

    assert u.progress() == 1
Exemplo n.º 3
0
def test_update_appimaged(appimaged_path, tmpdir):
    test_dir = tmpdir.mkdir("test_update_appimaged")

    # need to copy appimaged to another directory
    # as libappimageupdate will update the file in-place (i.e., create a file
    # next to the original file), we need to copy appimaged to the temporary
    # directory and update it there
    new_appimaged_path = test_dir.join("appimaged.AppImage")
    shutil.copyfile(appimaged_path, new_appimaged_path)

    u = Updater(str(new_appimaged_path))
    u.start()

    while not u.is_done():
        time.sleep(1)

    assert not u.has_error()
    assert u.state() == UpdaterState.SUCCESS

    path_to_new_file = u.path_to_new_file()
    assert path_to_new_file == os.path.join(test_dir,
                                            "appimaged-x86_64.AppImage")