FreedomBox/plinth/tests/conftest.py
Sunil Mohan Adapa 3dfceda785
frontpage: Read from .d files too
Read from following paths:

/etc/freedombox/custom-shortcuts.json
/etc/freedombox/custom-shortcuts.json.d/*.json
/etc/plinth/custom-shortcuts.json
/etc/plinth/custom-shortcuts.json.d/*.json
/var/lib/freedombox/custom-shortcuts.json
/var/lib/freedombox/custom-shortcuts.json.d/*.json
/usr/share/freedombox/custom-shortcuts.json
/usr/share/freedombox/custom-shortcuts.json.d/*.json

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-06-28 21:01:45 -04:00

24 lines
571 B
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
pytest configuration for all tests in the plinth/tests/ directory.
"""
import pathlib
from unittest.mock import patch
import pytest
from plinth import cfg
@pytest.fixture(name='shortcuts_file')
def fixture_shortcuts_file():
with patch('plinth.frontpage.get_custom_shortcuts_paths') as func:
def setter(file_name):
path = pathlib.Path(__file__).parent / 'data' / 'shortcuts'
path /= file_name
func.return_value = cfg.expand_to_dot_d_paths([path])
yield setter