mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
shaarli: Completely uninstall app
* remove data directory when app is uninstalled Tests: 1. Install and configure the app 2. Reinstall app and confirm the initial setup page is shown Signed-off-by: nbenedek <contact@nbenedek.me> [sunil: Update docstrings, make uninstall fail-safe] [sunil: Fix uninstall test by setting up after reinstall] Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
be7fd45393
commit
6ab0be6f9a
@ -12,7 +12,7 @@ from plinth.modules.backups.components import BackupRestore
|
|||||||
from plinth.modules.firewall.components import Firewall
|
from plinth.modules.firewall.components import Firewall
|
||||||
from plinth.package import Packages
|
from plinth.package import Packages
|
||||||
|
|
||||||
from . import manifest
|
from . import manifest, privileged
|
||||||
|
|
||||||
_description = [
|
_description = [
|
||||||
_('Shaarli allows you to save and share bookmarks.'),
|
_('Shaarli allows you to save and share bookmarks.'),
|
||||||
@ -69,3 +69,8 @@ class ShaarliApp(app_module.App):
|
|||||||
"""Install and configure the app."""
|
"""Install and configure the app."""
|
||||||
super().setup(old_version)
|
super().setup(old_version)
|
||||||
self.enable()
|
self.enable()
|
||||||
|
|
||||||
|
def uninstall(self):
|
||||||
|
"""De-configure and uninstall the app."""
|
||||||
|
super().uninstall()
|
||||||
|
privileged.uninstall()
|
||||||
|
|||||||
12
plinth/modules/shaarli/privileged.py
Normal file
12
plinth/modules/shaarli/privileged.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
"""Configure Shaarli."""
|
||||||
|
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
from plinth.actions import privileged
|
||||||
|
|
||||||
|
|
||||||
|
@privileged
|
||||||
|
def uninstall():
|
||||||
|
"""Remove Shaarli's data directory."""
|
||||||
|
shutil.rmtree('/var/lib/shaarli/data', ignore_errors=True)
|
||||||
@ -74,3 +74,8 @@ class TestShaarliApp(functional.BaseAppTests):
|
|||||||
assert len(links) > 0
|
assert len(links) > 0
|
||||||
|
|
||||||
# TODO: Test deleting bookmarks.
|
# TODO: Test deleting bookmarks.
|
||||||
|
|
||||||
|
def test_uninstall(self, session_browser):
|
||||||
|
"""After uninstall test, after installing run initial setup."""
|
||||||
|
super().test_uninstall(session_browser)
|
||||||
|
self._shaarli_is_setup(session_browser)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user