craftbeerpi4-pione/tests/cbpi_config_fixture.py
prash3r e7aa0a64c7 repairs log_file_controller.py.
I seem to have exidentally search and replaced some
needed glob.glob calls when adding dinamic log location,
which should now be repaired.
There also was a mysterious cbpi_dashboard_1.json appearing
in the wrong folder which now inside the dashboard folder.
I also figured out how to run tests locally,
they should now respect the dynamic folder paths.
2022-09-24 15:19:34 +02:00

24 lines
876 B
Python

# content of conftest.py
from codecs import ignore_errors
from distutils.command.config import config
import os
from cbpi.configFolder import ConfigFolder
from cbpi.craftbeerpi import CraftBeerPi
from aiohttp.test_utils import AioHTTPTestCase
from distutils.dir_util import copy_tree
class CraftBeerPiTestCase(AioHTTPTestCase):
async def get_application(self):
self.config_folder = self.configuration()
self.cbpi = CraftBeerPi(self.config_folder)
await self.cbpi.init_serivces()
return self.cbpi.app
def configuration(self):
test_directory = os.path.dirname(__file__)
test_config_directory = os.path.join(test_directory, 'cbpi-test-config')
test_logs_directory = os.path.join(test_directory, 'logs')
configFolder = ConfigFolder(test_config_directory, test_logs_directory)
return configFolder