mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
*: Miscellaneous changes to work with reduce the use of term 'plinth'
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
2782fba9bb
commit
80dceb12f4
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -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']
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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 "
|
||||
|
||||
@ -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/<uuid>
|
||||
backups_ssh_repo_uuid = 'fbx_test_sshfs' # will be mounted to /media/<uuid>
|
||||
|
||||
# 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
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user