S allius/issue393 (#403)

* display proxy version on dashboard

* add MQTT page

* styles adjusted on the different pages

- use same colors
- add bordered shadow to all cards and tables

* fix unit tests

* migrate the conn table to a general table

- rename the template file
- get headline from table description

* remove footer from index page

* make version string translateable

* cleanup

* remove stripped table rows

* add mqtt info table

* translate mqtt page

* don't fetch notes list for the log-page

* fix Mqtt init call for unit tests

* add mqtt-fetch test

* check received counter in unit test
This commit is contained in:
Stefan Allius
2025-05-03 23:45:10 +02:00
committed by GitHub
parent 41515f4be3
commit e15db8c92a
16 changed files with 264 additions and 54 deletions

View File

@@ -7,6 +7,7 @@ from gen3plus.inverter_g3p import InverterG3P
from test_inverter_g3p import FakeReader, FakeWriter, config_conn
from cnf.config import Config
from mock import patch
from proxy import Proxy
import os, errno
pytest_plugins = ('pytest_asyncio',)
@@ -53,16 +54,16 @@ async def test_home(client):
@pytest.mark.asyncio
async def test_page(client):
"""Test the empty page route."""
response = await client.get('/page')
"""Test the mqtt page route."""
response = await client.get('/mqtt')
assert response.status_code == 200
assert response.mimetype == 'text/html'
@pytest.mark.asyncio
async def test_rel_page(client):
"""Test the empty page route."""
"""Test the mqtt route."""
web.build_relative_urls = True
response = await client.get('/page')
response = await client.get('/mqtt')
assert response.status_code == 200
assert response.mimetype == 'text/html'
web.build_relative_urls = False
@@ -152,7 +153,7 @@ async def test_language_en(client):
assert response.mimetype == 'text/html'
client.set_cookie('test', key='language', value='de')
response = await client.get('/page')
response = await client.get('/mqtt')
assert response.status_code == 200
assert response.mimetype == 'text/html'
@@ -174,6 +175,16 @@ async def test_language_unknown(client):
assert response.mimetype == 'text/html'
@pytest.mark.asyncio
async def test_mqtt_fetch(client, create_inverter):
"""Test the mqtt-fetch route."""
_ = create_inverter
Proxy.class_init()
response = await client.get('/mqtt-fetch')
assert response.status_code == 200
@pytest.mark.asyncio
async def test_file_fetch(client, config_conn):
"""Test the data-fetch route."""