adjusted tests

This commit is contained in:
DJ2LS 2024-03-19 13:19:13 +01:00
parent 9da3fb80f0
commit aaa2084bfd
3 changed files with 6 additions and 4 deletions

View file

@ -241,6 +241,7 @@ class P2PConnection:
def received_data(self, frame):
print(frame)
self.p2p_data_rx_queue.put(frame['data'])
ack_data = self.frame_factory.build_p2p_connection_payload_ack(self.session_id, 0)
self.launch_twr_irs(ack_data, self.ENTIRE_CONNECTION_TIMEOUT, mode=FREEDV_MODE.signalling)

View file

@ -219,6 +219,7 @@ class StateManager:
def register_p2p_connection_session(self, session):
if session.session_id in self.p2p_connection_sessions:
print("session already registered...")
return False
self.p2p_connection_sessions[session.session_id] = session
return True

View file

@ -160,15 +160,12 @@ class TestP2PConnectionSession(unittest.TestCase):
for session_id in self.iss_state_manager.p2p_connection_sessions:
session = self.iss_state_manager.get_p2p_connection_session(session_id)
session.ENTIRE_CONNECTION_TIMEOUT = 15
# Generate and add 5 random entries to the queue
for _ in range(5):
random_entry = self.generate_random_string(2, 11)
session.p2p_data_tx_queue.put(random_entry)
self.waitAndCloseChannels()
@ -185,6 +182,9 @@ class TestSocket:
if b'CONNECTED AA1AAA-1 BB2BBB-2 0\r\n' in self.sent_data:
self.test_class.connected_event.set()
if b'DISCONNECTED\r\n' in self.sent_data:
self.test_class.assertEqual(b'DISCONNECTED\r\n', b'DISCONNECTED\r\n')
if __name__ == '__main__':
unittest.main()