increase test coverage, remove obsolete if statement
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user