mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-08-25 23:11:14 +00:00
Json configuration (#141)
* Add json config * Adjust code to new config --------- Co-authored-by: Chris <git@nootch.de>
This commit is contained in:
@@ -1,10 +1,24 @@
|
||||
from http import HTTPStatus
|
||||
from pathlib import Path
|
||||
|
||||
import requests
|
||||
|
||||
from akkudoktoreos.config import prediction_hours
|
||||
from akkudoktoreos.config import CONFIG_FILE_NAME, load_config
|
||||
|
||||
|
||||
def test_server(server):
|
||||
def test_fixture_setup(server, tmp_path: Path) -> None:
|
||||
"""Test if the fixture sets up the server with the env var."""
|
||||
# validate correct path in server
|
||||
config = load_config(tmp_path, False)
|
||||
assert tmp_path.joinpath(CONFIG_FILE_NAME).is_file()
|
||||
cache = tmp_path / config.directories.cache
|
||||
assert cache.is_dir()
|
||||
|
||||
|
||||
def test_server(server, tmp_path: Path):
|
||||
"""Test the server."""
|
||||
result = requests.get(f"{server}/gesamtlast_simple?year_energy=2000&")
|
||||
assert result.status_code == 200
|
||||
assert len(result.json()) == prediction_hours
|
||||
assert result.status_code == HTTPStatus.OK
|
||||
|
||||
config = load_config(tmp_path, False)
|
||||
assert len(result.json()) == config.eos.prediction_hours
|
||||
|
Reference in New Issue
Block a user