diff --git a/app/src/web/conn_table.py b/app/src/web/conn_table.py index cfc6072..50258aa 100644 --- a/app/src/web/conn_table.py +++ b/app/src/web/conn_table.py @@ -19,16 +19,13 @@ def _get_cloud_icon(emu_mode: bool): def _get_row(inv: InverterBase): '''build one row for the connection table''' - ip1, port1 = inv.addr client_mode = inv.client_mode - icon1 = '' + inv_serial = inv.local.stream.inv_serial + icon1 = _get_device_icon(client_mode) + ip1, port1 = inv.addr icon2 = '' ip2 = '--' port2 = '--' - inv_serial = '' - if inv.local.stream: - inv_serial = inv.local.stream.inv_serial - icon1 = _get_device_icon(client_mode) if inv.remote.ifc: ip2, port2 = inv.remote.ifc.r_addr diff --git a/app/tests/test_web_route.py b/app/tests/test_web_route.py index 89ec0a8..ff5e8c2 100644 --- a/app/tests/test_web_route.py +++ b/app/tests/test_web_route.py @@ -8,6 +8,13 @@ from test_inverter_g3p import FakeReader, FakeWriter, config_conn pytest_plugins = ('pytest_asyncio',) +@pytest.fixture +def create_inverter(config_conn): + _ = config_conn + inv = InverterG3P(FakeReader(), FakeWriter(), client_mode=False) + + return inv + @pytest.fixture def create_inverter_server(config_conn): _ = config_conn @@ -85,6 +92,17 @@ async def test_manifest(): assert response.status_code == 200 assert response.mimetype == 'application/manifest+json' +@pytest.mark.asyncio +async def test_data_fetch(create_inverter): + """Test the healthy route.""" + _ = create_inverter + client = app.test_client() + response = await client.get('/data-fetch') + assert response.status_code == 200 + + response = await client.get('/data-fetch') + assert response.status_code == 200 + @pytest.mark.asyncio async def test_data_fetch1(create_inverter_server): """Test the healthy route."""