Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test_server Closes #147 #148

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix test_server Closes #147
 * Don´t rely on calculation per specific day, just verify length.
Lasall committed Oct 9, 2024
commit f7c97ac0845f2d2b2a65cbcb767442e6a894f83f
57 changes: 3 additions & 54 deletions tests/test_server.py
Original file line number Diff line number Diff line change
@@ -1,63 +1,12 @@
import requests

from akkudoktoreos.config import prediction_hours


def test_server(server):
"""
Test the server
"""
result = requests.get(f"{server}/gesamtlast_simple?year_energy=2000&")
assert result.status_code == 200
assert (
result.text
== """[
0.12399409965368197,
0.12082955072761034,
0.1186152098599658,
0.13282048719613798,
0.16801614895243458,
0.18833079485066814,
0.2060958576163904,
0.23815979421159755,
0.256794470747979,
0.2730286944402595,
0.2837831370699189,
0.2880791113592318,
0.27868845536305187,
0.2593976275300202,
0.26565341182134644,
0.2834322084492842,
0.3385133447353511,
0.36541124595269503,
0.33781770981176945,
0.29218838246014817,
0.24535542466592053,
0.19484917288665324,
0.15634028941335018,
0.13309410380383394,
0.1239736903705896,
0.12074280282759843,
0.11849705069574769,
0.1320224904313182,
0.16699106562771282,
0.18856343364342354,
0.20578134176859084,
0.23760516695843145,
0.25675411140321175,
0.2729442256919556,
0.2837782018548114,
0.2882881388086184,
0.2800061651414149,
0.26039842637914645,
0.26613497240454587,
0.28441116400389416,
0.33941195977626437,
0.36621100374643395,
0.3391062422788601,
0.29391186081171267,
0.24686897327498972,
0.19620626090788126,
0.1570820352949701,
0.13332596485058107
]
"""
)
assert len(result.json()) == prediction_hours