cfg: Rename configuration file to freedombox.config

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2020-06-23 22:43:51 -07:00 committed by James Valleroy
parent 50ef5861d0
commit 6b1622bcec
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
7 changed files with 14 additions and 14 deletions

View File

@ -52,7 +52,7 @@ def fixture_load_cfg():
root_dir = pathlib.Path(__file__).resolve().parent
test_data_dir = root_dir / 'plinth' / 'tests' / 'data'
cfg_file = test_data_dir / 'etc' / 'plinth' / 'plinth.config'
cfg_file = test_data_dir / 'configs' / 'freedombox.config'
cfg.read_file(str(cfg_file))
yield cfg
cfg.read_file(str(cfg_file))

View File

@ -105,7 +105,7 @@ def run_diagnostics_and_exit():
def adapt_config(arguments):
"""Give commandline arguments precedence over plinth.config entries"""
"""Give commandline arguments precedence over config entries"""
for argument_name in precedence_commandline_arguments:
argument_value = getattr(arguments, argument_name)
if argument_value is not None:

View File

@ -60,7 +60,7 @@ def get_develop_config_path():
def get_config_path():
"""Get default config paths."""
return '/etc/plinth/plinth.config'
return '/etc/freedombox/freedombox.config'
def read():

View File

@ -14,11 +14,12 @@ import pytest
from plinth import cfg
TEST_CONFIG_DIR = \
os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data')
os.path.join(os.path.dirname(os.path.realpath(__file__)),
'data', 'configs')
CONFIG_FILE_WITH_MISSING_OPTIONS = \
os.path.join(TEST_CONFIG_DIR, 'plinth.config.with_missing_options')
os.path.join(TEST_CONFIG_DIR, 'freedombox.config.with_missing_options')
CONFIG_FILE_WITH_MISSING_SECTIONS = \
os.path.join(TEST_CONFIG_DIR, 'plinth.config.with_missing_sections')
os.path.join(TEST_CONFIG_DIR, 'freedombox.config.with_missing_sections')
logging.disable(logging.CRITICAL)
@ -29,12 +30,15 @@ def test_read_default_config_file():
"""Verify that the default config file can be read correctly."""
config_file = cfg.get_develop_config_path()
# Read the plinth.config file directly
# Read the freedombox.config file directly
parser = configparser.ConfigParser(
defaults={'parent_dir': pathlib.Path(config_file).parent})
defaults={
'parent_dir': pathlib.Path(config_file).parent,
'parent_parent_dir': pathlib.Path(config_file).parent.parent
})
parser.read(config_file)
# Read the plinth.config file via the cfg module
# Read the freedombox.config file via the cfg module
cfg.read_file(config_file)
# Compare the two results
@ -81,9 +85,6 @@ def test_read_config_file_with_missing_options():
def compare_configurations(parser):
"""Compare two sets of configuration values."""
# Note that the count of items within each section includes the number
# of default items (1, for 'root').
assert len(parser.items('Path')) == 9
assert parser.get('Path', 'file_root') == cfg.file_root
assert parser.get('Path', 'config_dir') == cfg.config_dir
assert parser.get('Path', 'custom_static_dir') == cfg.custom_static_dir
@ -92,7 +93,6 @@ def compare_configurations(parser):
assert parser.get('Path', 'actions_dir') == cfg.actions_dir
assert parser.get('Path', 'doc_dir') == cfg.doc_dir
assert len(parser.items('Network')) == 6
assert parser.get('Network', 'host') == cfg.host
assert int(parser.get('Network', 'port')) == cfg.port
assert parser.get('Network', 'secure_proxy_ssl_header') == \
@ -103,5 +103,5 @@ def compare_configurations(parser):
assert isinstance(cfg.use_x_forwarded_host, bool)
assert parser.get('Network', 'use_x_forwarded_host') == \
str(cfg.use_x_forwarded_host)
assert len(parser.items('Misc')) == 2
assert parser.get('Misc', 'box_name') == cfg.box_name