split ConnectionG3(P) in server and client class

This commit is contained in:
Stefan Allius
2024-09-27 00:47:44 +02:00
parent 73526b7dc6
commit aa7c1832ef
10 changed files with 548 additions and 475 deletions

View File

@@ -8,7 +8,7 @@ from app.src.infos import Infos
from app.src.config import Config
from app.src.inverter import Inverter
from app.src.singleton import Singleton
from app.src.gen3.connection_g3 import ConnectionG3
from app.src.gen3.connection_g3 import ConnectionG3Server
from app.src.gen3.inverter_g3 import InverterG3
from app.tests.test_modbus_tcp import patch_mqtt_err, patch_mqtt_except, test_port, test_hostname
@@ -44,12 +44,12 @@ def module_init():
@pytest.fixture
def patch_conn_init():
with patch.object(ConnectionG3, '__init__', return_value= None) as conn:
with patch.object(ConnectionG3Server, '__init__', return_value= None) as conn:
yield conn
@pytest.fixture
def patch_conn_close():
with patch.object(ConnectionG3, 'close') as conn:
with patch.object(ConnectionG3Server, 'close') as conn:
yield conn
class FakeReader():
@@ -115,7 +115,7 @@ def test_method_calls(patch_conn_init, patch_conn_close):
inverter.r_addr = ''
spy1.assert_called_once()
spy1.assert_called_once_with(reader, writer, addr, None, True)
spy1.assert_called_once_with(reader, writer, addr, None)
inverter.close()
spy2.assert_called_once()