Code coverage for SonarCloud (#150)
* cleanup code and unit tests * add test coverage for SonarCloud * configure SonarCloud * update changelog
This commit is contained in:
@@ -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''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user