Code coverage for SonarCloud (#150)

* cleanup code and unit tests

* add test coverage for SonarCloud

* configure SonarCloud

* update changelog
This commit is contained in:
Stefan Allius
2024-08-09 17:45:53 +02:00
committed by GitHub
parent 155b6d4e67
commit d891e486e7
9 changed files with 36 additions and 95 deletions

View File

@@ -1,8 +1,6 @@
# test_with_pytest.py and scapy
#
import pytest, socket, time
#from scapy.all import *
#from scapy.layers.inet import IP, TCP, TCP_client
def get_sn() -> bytes:
return b'R170000000000001'
@@ -120,9 +118,7 @@ def MsgOtaUpdateReq(): # Over the air update request from talent cloud
@pytest.fixture(scope="session")
def ClientConnection():
#host = '172.16.30.7'
host = 'logger.talent-monitoring.com'
#host = '127.0.0.1'
port = 5005
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((host, port))
@@ -132,9 +128,7 @@ def ClientConnection():
s.close()
def tempClientConnection():
#host = '172.16.30.7'
host = 'logger.talent-monitoring.com'
#host = '127.0.0.1'
port = 5005
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((host, port))
@@ -148,7 +142,6 @@ def test_open_close():
pass
except:
assert False
assert True
def test_send_contact_info1(ClientConnection, MsgContactInfo, MsgContactResp):
s = ClientConnection
@@ -166,7 +159,7 @@ def test_send_contact_info2(ClientConnection, MsgContactInfo2, MsgContactInfo, M
s.sendall(MsgContactInfo2)
data = s.recv(1024)
except TimeoutError:
assert True
pass
else:
assert False
@@ -198,7 +191,7 @@ def test_send_contact_resp(ClientConnection, MsgContactResp):
s.sendall(MsgContactResp)
data = s.recv(1024)
except TimeoutError:
assert True
pass
else:
assert data == b''