From 80dceb12f48b42f436917b784f109bcf7c1be3d4 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 17 Aug 2026 15:51:46 -0700 Subject: [PATCH] *: Miscellaneous changes to work with reduce the use of term 'plinth' Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- freedombox/modules/apache/__init__.py | 2 +- .../modules/config/tests/test_config.py | 6 +-- .../modules/gitweb/tests/test_functional.py | 2 +- .../modules/samba/tests/test_functional.py | 2 +- .../modules/storage/tests/test_storage.py | 6 +-- freedombox/privileged/service.py | 28 ++++++------- freedombox/tests/config.py | 2 +- freedombox/tests/test_app.py | 3 +- freedombox/tests/test_network.py | 41 +++++++++---------- 9 files changed, 46 insertions(+), 46 deletions(-) diff --git a/freedombox/modules/apache/__init__.py b/freedombox/modules/apache/__init__.py index 890544781..8df691a4b 100644 --- a/freedombox/modules/apache/__init__.py +++ b/freedombox/modules/apache/__init__.py @@ -113,7 +113,7 @@ class ApacheApp(app_module.App): self.add(web_server_ports) freedombox_ports = Firewall( - 'firewall-plinth', + 'firewall-freedombox', format_lazy(_('{box_name} Web Interface (Plinth)'), box_name=_(cfg.box_name)), ports=['http', 'https'], is_external=True) diff --git a/freedombox/modules/config/tests/test_config.py b/freedombox/modules/config/tests/test_config.py index 6ae4943d2..abdb10060 100644 --- a/freedombox/modules/config/tests/test_config.py +++ b/freedombox/modules/config/tests/test_config.py @@ -9,7 +9,7 @@ from unittest.mock import Mock, patch import pytest -from freedombox import __main__ as plinth_main +from freedombox import __main__ as freedombox_main from freedombox import utils from freedombox.modules.apache import uws_directory_of_user, uws_url_of_user from freedombox.modules.config import (_home_page_scid2url, change_home_page, @@ -131,6 +131,6 @@ def test_locale_path(): Test that the 'locale' directory is in the same folder as __main__.py. This is required for detecting translated languages. """ - plinth_dir = os.path.dirname(plinth_main.__file__) - locale_dir = os.path.join(plinth_dir, 'locale') + freedombox_dir = os.path.dirname(freedombox_main.__file__) + locale_dir = os.path.join(freedombox_dir, 'locale') assert os.path.isdir(locale_dir) diff --git a/freedombox/modules/gitweb/tests/test_functional.py b/freedombox/modules/gitweb/tests/test_functional.py index 510451569..5b4d576a6 100644 --- a/freedombox/modules/gitweb/tests/test_functional.py +++ b/freedombox/modules/gitweb/tests/test_functional.py @@ -260,7 +260,7 @@ def _gitweb_git_command_is_successful(command, cwd): @contextlib.contextmanager def _gitweb_temp_directory(): """Create temporary directory""" - name = tempfile.mkdtemp(prefix='plinth_test_gitweb_') + name = tempfile.mkdtemp(prefix='fbx_test_gitweb_') yield name shutil.rmtree(name) diff --git a/freedombox/modules/samba/tests/test_functional.py b/freedombox/modules/samba/tests/test_functional.py index 054a6e022..0be014838 100644 --- a/freedombox/modules/samba/tests/test_functional.py +++ b/freedombox/modules/samba/tests/test_functional.py @@ -67,7 +67,7 @@ def _write_to_share(share_type, as_guest=False): share_name = '{0}_{1}'.format(disk_name, share_type) hostname = urllib.parse.urlparse(default_url).hostname servicename = '\\\\{0}\\{1}'.format(hostname, share_name) - directory = '_plinth-test_{0}'.format(''.join( + directory = '_freedombox-test_{0}'.format(''.join( random.SystemRandom().choices(string.ascii_letters, k=8))) port = functional.config['DEFAULT']['samba_port'] diff --git a/freedombox/modules/storage/tests/test_storage.py b/freedombox/modules/storage/tests/test_storage.py index 07b91ac0f..5557db2fc 100644 --- a/freedombox/modules/storage/tests/test_storage.py +++ b/freedombox/modules/storage/tests/test_storage.py @@ -366,9 +366,9 @@ def test_validate_directory_writable(path, error): @pytest.mark.usefixtures('needs_not_root') @pytest.mark.parametrize( 'path,error', - [('/var/lib/plinth_storage_test_not_exists', PermissionError('write')), - ('/tmp/plint_storage_test_not_exists', None), - ('/var/../tmp/plint_storage_test_not_exists', None)]) + [('/var/lib/fbx_storage_test_not_exists', PermissionError('write')), + ('/tmp/fbx_storage_test_not_exists', None), + ('/var/../tmp/fbx_storage_test_not_exists', None)]) def test_validate_directory_creatable(path, error): """Test that directory creatable validation returns expected output.""" _assert_validate_directory(path, error, check_creatable=True) diff --git a/freedombox/privileged/service.py b/freedombox/privileged/service.py index 955e8789a..da8941faf 100644 --- a/freedombox/privileged/service.py +++ b/freedombox/privileged/service.py @@ -20,49 +20,49 @@ def systemd_set_default(target: str): @privileged def start(service: str): """Start a service.""" - _assert_service_is_managed_by_plinth(service) + _assert_service_is_managed_by_freedombox(service) action_utils.service_start(service) @privileged def stop(service: str): """Stop a running service.""" - _assert_service_is_managed_by_plinth(service) + _assert_service_is_managed_by_freedombox(service) action_utils.service_stop(service) @privileged def enable(service: str): """Enable a service so that it start on system boot.""" - _assert_service_is_managed_by_plinth(service) + _assert_service_is_managed_by_freedombox(service) action_utils.service_enable(service) @privileged def disable(service: str): """Disable a service so that it does not start on system boot.""" - _assert_service_is_managed_by_plinth(service) + _assert_service_is_managed_by_freedombox(service) action_utils.service_disable(service) @privileged def restart(service: str): """Restart a service.""" - _assert_service_is_managed_by_plinth(service) + _assert_service_is_managed_by_freedombox(service) action_utils.service_restart(service) @privileged def try_restart(service: str): """Restart a service if it is running.""" - _assert_service_is_managed_by_plinth(service) + _assert_service_is_managed_by_freedombox(service) action_utils.service_try_restart(service) @privileged def reload(service: str): """Reload a service.""" - _assert_service_is_managed_by_plinth(service) + _assert_service_is_managed_by_freedombox(service) action_utils.service_reload(service) @@ -72,41 +72,41 @@ def try_reload_or_restart(service: str): Do nothing if service is not running. """ - _assert_service_is_managed_by_plinth(service) + _assert_service_is_managed_by_freedombox(service) action_utils.service_try_reload_or_restart(service) @privileged def mask(service: str): """Mask a service.""" - _assert_service_is_managed_by_plinth(service) + _assert_service_is_managed_by_freedombox(service) action_utils.service_mask(service) @privileged def unmask(service: str): """Unmask a service.""" - _assert_service_is_managed_by_plinth(service) + _assert_service_is_managed_by_freedombox(service) action_utils.service_unmask(service) @privileged def is_enabled(service: str) -> bool: """Return whether a service is enabled.""" - _assert_service_is_managed_by_plinth(service) + _assert_service_is_managed_by_freedombox(service) return action_utils.service_is_enabled(service) @privileged def is_running(service: str) -> bool: """Return whether a service is running.""" - _assert_service_is_managed_by_plinth(service) + _assert_service_is_managed_by_freedombox(service) return action_utils.service_is_running(service) @privileged def get_logs(service: str) -> dict[str, str]: - _assert_service_is_managed_by_plinth(service) + _assert_service_is_managed_by_freedombox(service) return { 'unit': service, 'description': action_utils.service_show(service)['Description'], @@ -139,7 +139,7 @@ def _get_managed_services(): return services -def _assert_service_is_managed_by_plinth(service_name): +def _assert_service_is_managed_by_freedombox(service_name): managed_services = _get_managed_services() if service_name not in managed_services: msg = ("The service '%s' is not managed by FreedomBox. Access is only " diff --git a/freedombox/tests/config.py b/freedombox/tests/config.py index 9391c2993..0dbaee985 100644 --- a/freedombox/tests/config.py +++ b/freedombox/tests/config.py @@ -12,7 +12,7 @@ backups_ssh_path = None # provide backups_ssh_path and either a password or a keyfile for ssh tests backups_ssh_password = None backups_ssh_keyfile = None -backups_ssh_repo_uuid = 'plinth_test_sshfs' # will be mounted to /media/ +backups_ssh_repo_uuid = 'fbx_test_sshfs' # will be mounted to /media/ # An existing admin account for privileged actions. If this admin account # doesn't exist and no other admin accounts exist, a random admin account is diff --git a/freedombox/tests/test_app.py b/freedombox/tests/test_app.py index 6cf241791..798e739d5 100644 --- a/freedombox/tests/test_app.py +++ b/freedombox/tests/test_app.py @@ -345,7 +345,8 @@ def test_app_has_logs(app_with_components): assert not app.has_diagnostics() -@patch('freedombox.privileged.service._assert_service_is_managed_by_plinth') +@patch( + 'freedombox.privileged.service._assert_service_is_managed_by_freedombox') @patch('freedombox.action_utils.service_get_logs') @patch('freedombox.action_utils.service_show') def test_app_get_logs(service_show, service_get_logs, _, app_with_components, diff --git a/freedombox/tests/test_network.py b/freedombox/tests/test_network.py index e0f05812b..0e006b62c 100644 --- a/freedombox/tests/test_network.py +++ b/freedombox/tests/test_network.py @@ -14,7 +14,7 @@ from freedombox.utils import import_from_gi ethernet_settings = { 'common': { 'type': '802-3-ethernet', - 'name': 'plinth_test_eth', + 'name': 'fbx_test_eth', 'interface': 'eth0', 'zone': 'internal', 'dns_over_tls': 'opportunistic', @@ -34,7 +34,7 @@ ethernet_settings = { wifi_settings = { 'common': { 'type': '802-11-wireless', - 'name': 'plinth_test_wifi', + 'name': 'fbx_test_wifi', 'interface': 'wlan0', 'zone': 'external', 'dns_over_tls': 'yes', @@ -50,7 +50,7 @@ wifi_settings = { 'second_dns': '', }, 'wireless': { - 'ssid': 'plinthtestwifi', + 'ssid': 'fbxtestwifi', 'mode': 'adhoc', 'auth_mode': 'open', 'band': 'a', @@ -62,7 +62,7 @@ wifi_settings = { pppoe_settings = { 'common': { 'type': 'pppoe', - 'name': 'plinth_test_pppoe', + 'name': 'fbx_test_pppoe', 'interface': 'eth1', 'zone': 'internal', }, @@ -139,18 +139,18 @@ def test_get_connection_list(network): connections = network.get_connection_list() connection_names = [conn['name'] for conn in connections] - assert 'plinth_test_eth' in connection_names - assert 'plinth_test_wifi' in connection_names - assert 'plinth_test_pppoe' in connection_names + assert 'fbx_test_eth' in connection_names + assert 'fbx_test_wifi' in connection_names + assert 'fbx_test_pppoe' in connection_names def test_get_connection(network, ethernet_uuid, wifi_uuid): """Check that we can get a connection by name.""" connection = network.get_connection(ethernet_uuid) - assert connection.get_id() == 'plinth_test_eth' + assert connection.get_id() == 'fbx_test_eth' connection = network.get_connection(wifi_uuid) - assert connection.get_id() == 'plinth_test_wifi' + assert connection.get_id() == 'fbx_test_wifi' with pytest.raises(network.ConnectionNotFound): network.get_connection('x-invalid-network-id') @@ -160,7 +160,7 @@ def test_edit_ethernet_connection(network, ethernet_uuid): """Check that we can update an ethernet connection.""" connection = network.get_connection(ethernet_uuid) ethernet_settings2 = copy.deepcopy(ethernet_settings) - ethernet_settings2['common']['name'] = 'plinth_test_eth_new' + ethernet_settings2['common']['name'] = 'fbx_test_eth_new' ethernet_settings2['common']['interface'] = 'eth1' ethernet_settings2['common']['zone'] = 'external' ethernet_settings2['common']['dns_over_tls'] = 'no' @@ -169,7 +169,7 @@ def test_edit_ethernet_connection(network, ethernet_uuid): network.edit_connection(connection, ethernet_settings2) connection = network.get_connection(ethernet_uuid) - assert connection.get_id() == 'plinth_test_eth_new' + assert connection.get_id() == 'fbx_test_eth_new' settings_connection = connection.get_setting_connection() assert settings_connection.get_interface_name() == 'eth1' @@ -185,7 +185,7 @@ def test_edit_pppoe_connection(network, pppoe_uuid): """Check that we can update a PPPoE connection.""" connection = network.get_connection(pppoe_uuid) pppoe_settings2 = copy.deepcopy(pppoe_settings) - pppoe_settings2['common']['name'] = 'plinth_test_pppoe_new' + pppoe_settings2['common']['name'] = 'fbx_test_pppoe_new' pppoe_settings2['common']['interface'] = 'eth2' pppoe_settings2['common']['zone'] = 'external' pppoe_settings2['common']['autoconnect'] = False @@ -194,7 +194,7 @@ def test_edit_pppoe_connection(network, pppoe_uuid): network.edit_connection(connection, pppoe_settings2) connection = network.get_connection(pppoe_uuid) - assert connection.get_id() == 'plinth_test_pppoe_new' + assert connection.get_id() == 'fbx_test_pppoe_new' settings_connection = connection.get_setting_connection() assert settings_connection.get_interface_name() == 'eth2' @@ -215,13 +215,13 @@ def test_edit_wifi_connection(network, wifi_uuid): """Check that we can update a wifi connection.""" connection = network.get_connection(wifi_uuid) wifi_settings2 = copy.deepcopy(wifi_settings) - wifi_settings2['common']['name'] = 'plinth_test_wifi_new' + wifi_settings2['common']['name'] = 'fbx_test_wifi_new' wifi_settings2['common']['interface'] = 'wlan1' wifi_settings2['common']['zone'] = 'external' wifi_settings2['common']['dns_over_tls'] = 'opportunistic' wifi_settings2['common']['autoconnect'] = False wifi_settings2['ipv4']['method'] = 'auto' - wifi_settings2['wireless']['ssid'] = 'plinthtestwifi2' + wifi_settings2['wireless']['ssid'] = 'fbxtestwifi2' wifi_settings2['wireless']['mode'] = 'infrastructure' wifi_settings2['wireless']['auth_mode'] = 'wpa' wifi_settings2['wireless']['passphrase'] = 'secretpassword' @@ -229,7 +229,7 @@ def test_edit_wifi_connection(network, wifi_uuid): connection = network.get_connection(wifi_uuid) - assert connection.get_id() == 'plinth_test_wifi_new' + assert connection.get_id() == 'fbx_test_wifi_new' settings_connection = connection.get_setting_connection() assert settings_connection.get_interface_name() == 'wlan1' @@ -238,9 +238,8 @@ def test_edit_wifi_connection(network, wifi_uuid): assert not settings_connection.get_autoconnect() settings_wireless = connection.get_setting_wireless() - assert settings_wireless.get_ssid().get_data() == b'plinthtestwifi2' - assert settings_wireless.get_ssid().get_data().decode( - ) == 'plinthtestwifi2' + assert settings_wireless.get_ssid().get_data() == b'fbxtestwifi2' + assert settings_wireless.get_ssid().get_data().decode() == 'fbxtestwifi2' assert settings_wireless.get_mode() == 'infrastructure' wifi_sec = connection.get_setting_wireless_security() @@ -310,7 +309,7 @@ def test_wifi_manual_ipv4_address(network, wifi_uuid): wifi_settings2['ipv4']['gateway'] = '169.254.0.254' wifi_settings2['ipv4']['dns'] = '1.2.3.4' wifi_settings2['ipv4']['second_dns'] = '1.2.3.5' - wifi_settings2['wireless']['ssid'] = 'plinthtestwifi' + wifi_settings2['wireless']['ssid'] = 'fbxtestwifi' wifi_settings2['wireless']['mode'] = 'adhoc' wifi_settings2['wireless']['auth_mode'] = 'open' network.edit_connection(connection, wifi_settings2) @@ -338,7 +337,7 @@ def test_wifi_manual_ipv6_address(network, wifi_uuid): wifi_settings2['ipv6']['gateway'] = '::ffff:169.254.0.254' wifi_settings2['ipv6']['dns'] = '::ffff:1.2.3.4' wifi_settings2['ipv6']['second_dns'] = '::ffff:1.2.3.5' - wifi_settings2['wireless']['ssid'] = 'plinthtestwifi' + wifi_settings2['wireless']['ssid'] = 'fbxtestwifi' wifi_settings2['wireless']['mode'] = 'adhoc' wifi_settings2['wireless']['auth_mode'] = 'open' network.edit_connection(connection, wifi_settings2)