mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-07-22 11:59:33 +00:00
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:
parent
41fc24d296
commit
0c7c4b12fb
15
conftest.py
15
conftest.py
@ -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')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user