resolution of connection classes
- remove ConnectionG3Client - remove ConnectionG3Server - remove ConnectionG3PClient - remove ConnectionG3PServer
This commit is contained in:
@@ -5,8 +5,9 @@ import asyncio
|
||||
from itertools import count
|
||||
from mock import patch
|
||||
from app.src.singleton import Singleton
|
||||
from app.src.async_stream import AsyncStream, AsyncIfcImpl, StreamPtr
|
||||
from app.src.gen3plus.connection_g3p import ConnectionG3PServer
|
||||
from app.src.async_stream import StreamPtr
|
||||
from app.src.async_stream import AsyncStream, AsyncStreamServer, AsyncIfcImpl
|
||||
from app.src.gen3plus.connection_g3p import ConnectionG3P
|
||||
from app.src.gen3plus.solarman_v5 import SolarmanV5
|
||||
|
||||
|
||||
@@ -80,24 +81,25 @@ class FakeWriter():
|
||||
|
||||
|
||||
|
||||
def test_method_calls(patch_solarman_init, patch_healthy, patch_async_close, patch_solarman_close):
|
||||
def test_method_calls(patch_healthy, patch_async_close):
|
||||
AsyncIfcImpl._ids = count(5)
|
||||
spy2 = patch_solarman_init
|
||||
spy3 = patch_healthy
|
||||
spy4 = patch_async_close
|
||||
spy5 = patch_solarman_close
|
||||
reader = FakeReader()
|
||||
writer = FakeWriter()
|
||||
addr = ('proxy.local', 10000)
|
||||
conn = ConnectionG3PServer(FakeInverter(), reader, writer, addr,
|
||||
client_mode=False)
|
||||
assert 5 == conn._ifc.get_conn_no()
|
||||
spy2.assert_called_once_with(conn, True, False, conn._ifc)
|
||||
inv = FakeInverter()
|
||||
ifc = AsyncStreamServer(reader, writer,
|
||||
inv.async_publ_mqtt,
|
||||
inv.async_create_remote,
|
||||
inv.remote)
|
||||
conn = ConnectionG3P(addr, ifc, server_side=True, client_mode=False)
|
||||
assert 5 == conn.conn_no
|
||||
assert 5 == conn.ifc.get_conn_no()
|
||||
conn.healthy()
|
||||
|
||||
spy3.assert_called_once()
|
||||
|
||||
conn.close()
|
||||
spy4.assert_called_once()
|
||||
spy5.assert_called_once()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user