Ejemplo n.º 1
0
def test_describe_appimaged(appimaged_path):
    u = Updater(appimaged_path)

    description = u.describe_appimage()

    assert "AppImage type: 2" in description
    assert "Raw update information: gh-releases-zsync|AppImage|appimaged|continuous|appimaged*x86_64*.AppImage.zsync" in description
    assert "Update information type: ZSync via GitHub Releases" in description
Ejemplo n.º 2
0
def test_update_check_appimaged(appimaged_path):
    u = Updater(appimaged_path)

    updateAvailable = u.check_for_changes()

    # the appimaged AppImage is horribly out of date, so libappimageupdate
    # should report there's an update available
    assert updateAvailable
Ejemplo n.º 3
0
def test_describe_echo(echo_path):
    u = Updater(echo_path)

    description = u.describe_appimage()

    assert "AppImage type: 2" in description
    assert "Raw update information: <empty>" in description
    assert "Update information type: Invalid" in description
Ejemplo n.º 4
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
Ejemplo n.º 5
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
Ejemplo n.º 6
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")
Ejemplo n.º 7
0
def test_init_appimaged(appimaged_path):
    # try to instantiate Updater
    Updater(appimaged_path)
Ejemplo n.º 8
0
def test_init_echo(echo_path):
    # try to instantiate Updater
    Updater(echo_path)
Ejemplo n.º 9
0
def test_path_to_new_file(echo_path):
    u = Updater(echo_path)

    with pytest.raises(AppImageUpdateError):
        u.path_to_new_file()