tests: Use develop configuration for most tests

- Use the test configuration only when needed. This simplifies having to load
test configuration properly for action tests.

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-28 17:25:47 -07:00 committed by James Valleroy
parent 41fc24d296
commit 0c7c4b12fb
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -50,12 +50,21 @@ def fixture_load_cfg():
"""Load test configuration."""
from plinth import cfg
keys = ('file_root', 'config_dir', 'data_dir', 'custom_static_dir',
'store_file', 'actions_dir', 'doc_dir', 'server_dir', 'host',
'port', 'use_x_forwarded_for', 'use_x_forwarded_host',
'secure_proxy_ssl_header', 'box_name', 'develop')
saved_state = {}
for key in keys:
saved_state[key] = getattr(cfg, key)
root_dir = pathlib.Path(__file__).resolve().parent
test_data_dir = root_dir / 'plinth' / 'tests' / 'data'
cfg_file = test_data_dir / 'configs' / 'freedombox.config'
cfg_file = root_dir / 'plinth' / 'develop.config'
cfg.read_file(str(cfg_file))
yield cfg
cfg.read_file(str(cfg_file))
for key in keys:
setattr(cfg, key, saved_state[key])
@pytest.fixture(name='develop_mode')