From c7673e039dd5dde62c857db5d120a525d545d8c0 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sat, 15 Mar 2025 07:48:10 -0400 Subject: [PATCH] tests: functional: Add enable-all-apps script [sunil] - Move the script to plinth/tests/functional directory as it is the right place for it. - Add HACKING.md entry to talk about the script. - Update the pyproject.toml to ensure that functional tests config.ini is installed along with functional tests python code. Signed-off-by: James Valleroy Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- HACKING.md | 13 +++++++++++ plinth/tests/functional/enable-all-apps | 31 +++++++++++++++++++++++++ pyproject.toml | 7 +++++- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100755 plinth/tests/functional/enable-all-apps diff --git a/HACKING.md b/HACKING.md index 66860affd..7ac761a7f 100644 --- a/HACKING.md +++ b/HACKING.md @@ -589,6 +589,19 @@ installed. $ py.test-3 -n 4 --dist=loadfile --include-functional -m essential ``` +#### Enabling all apps + +When testing distribution upgrades from a stable release to next stable release +or testing, it is beneficial to install all available FreedomBox applications. +There is a script available to perform operation. + +In the VM or container, run the following command: + +``` +guest$ cd /freedombox +guest$ sudo make build install +guest$ plinth/tests/functional/enable-all-apps +``` [back to index](#hacking) diff --git a/plinth/tests/functional/enable-all-apps b/plinth/tests/functional/enable-all-apps new file mode 100755 index 000000000..f80e82d1b --- /dev/null +++ b/plinth/tests/functional/enable-all-apps @@ -0,0 +1,31 @@ +#!/usr/bin/python3 +# +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# Set FREEDOMBOX_URL to the URL of the FreedomBox on which +# all apps will be enabled. + +from splinter import Browser + +from plinth import app as app_module, module_loader +from plinth.tests.functional import app_enable, install, login + +module_loader.load_modules() +app_module.apps_init() + +browser = Browser('firefox') +login(browser) + +for app in app_module.App.list(): + app_name = app.app_id + try: + # Some apps cannot be installed. + install(browser, app_name) + except: + pass + + try: + app_enable(browser, app_name) + except: + # Some apps cannot be enabled. + pass diff --git a/pyproject.toml b/pyproject.toml index 7253f4d34..af8b4ae9e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -112,7 +112,12 @@ version = {attr = "plinth.__version__"} include = ["plinth", "plinth.*"] [tool.setuptools.package-data] -"*" = ["templates/*", "static/**", "locale/*/LC_MESSAGES/*.mo"] +"*" = [ + "templates/*", + "static/**", + "locale/*/LC_MESSAGES/*.mo", + "tests/functional/config.ini" +] [tool.setuptools.exclude-package-data] "*" = ["*/data/*"]