mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-10-01 03:15:44 -04:00
Add channel tests to all test suite
Also print name in each test
This commit is contained in:
parent
c00b592ed9
commit
44dc2d06c6
@ -4,6 +4,7 @@ from .hashes import TestSHA256
|
|||||||
from .hashes import TestSHA512
|
from .hashes import TestSHA512
|
||||||
from .identity import TestIdentity
|
from .identity import TestIdentity
|
||||||
from .link import TestLink
|
from .link import TestLink
|
||||||
|
from .channel import TestChannel
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(verbosity=2)
|
unittest.main(verbosity=2)
|
@ -164,6 +164,7 @@ class ProtocolHarness(contextlib.AbstractContextManager):
|
|||||||
|
|
||||||
class TestChannel(unittest.TestCase):
|
class TestChannel(unittest.TestCase):
|
||||||
def setUp(self) -> None:
|
def setUp(self) -> None:
|
||||||
|
print("")
|
||||||
self.rtt = 0.001
|
self.rtt = 0.001
|
||||||
self.retry_interval = self.rtt * 150
|
self.retry_interval = self.rtt * 150
|
||||||
Packet.timeout = self.retry_interval
|
Packet.timeout = self.retry_interval
|
||||||
@ -173,6 +174,7 @@ class TestChannel(unittest.TestCase):
|
|||||||
self.h.cleanup()
|
self.h.cleanup()
|
||||||
|
|
||||||
def test_send_one_retry(self):
|
def test_send_one_retry(self):
|
||||||
|
print("Channel test one retry")
|
||||||
message = MessageTest()
|
message = MessageTest()
|
||||||
|
|
||||||
self.assertEqual(0, len(self.h.outlet.packets))
|
self.assertEqual(0, len(self.h.outlet.packets))
|
||||||
@ -224,6 +226,7 @@ class TestChannel(unittest.TestCase):
|
|||||||
self.assertFalse(envelope.tracked)
|
self.assertFalse(envelope.tracked)
|
||||||
|
|
||||||
def test_send_timeout(self):
|
def test_send_timeout(self):
|
||||||
|
print("Channel test retry count exceeded")
|
||||||
message = MessageTest()
|
message = MessageTest()
|
||||||
|
|
||||||
self.assertEqual(0, len(self.h.outlet.packets))
|
self.assertEqual(0, len(self.h.outlet.packets))
|
||||||
@ -256,6 +259,8 @@ class TestChannel(unittest.TestCase):
|
|||||||
self.assertFalse(envelope.tracked)
|
self.assertFalse(envelope.tracked)
|
||||||
|
|
||||||
def test_multiple_handler(self):
|
def test_multiple_handler(self):
|
||||||
|
print("Channel test multiple handler short circuit")
|
||||||
|
|
||||||
handler1_called = 0
|
handler1_called = 0
|
||||||
handler1_return = True
|
handler1_return = True
|
||||||
handler2_called = 0
|
handler2_called = 0
|
||||||
@ -291,6 +296,7 @@ class TestChannel(unittest.TestCase):
|
|||||||
self.assertEqual(1, handler2_called)
|
self.assertEqual(1, handler2_called)
|
||||||
|
|
||||||
def test_system_message_check(self):
|
def test_system_message_check(self):
|
||||||
|
print("Channel test register system message")
|
||||||
with self.assertRaises(RNS.Channel.ChannelException):
|
with self.assertRaises(RNS.Channel.ChannelException):
|
||||||
self.h.channel.register_message_type(SystemMessage)
|
self.h.channel.register_message_type(SystemMessage)
|
||||||
self.h.channel.register_message_type(SystemMessage, is_system_type=True)
|
self.h.channel.register_message_type(SystemMessage, is_system_type=True)
|
||||||
@ -353,6 +359,7 @@ class TestChannel(unittest.TestCase):
|
|||||||
checker(rx_message)
|
checker(rx_message)
|
||||||
|
|
||||||
def test_send_receive_message_test(self):
|
def test_send_receive_message_test(self):
|
||||||
|
print("Channel test send and receive message")
|
||||||
message = MessageTest()
|
message = MessageTest()
|
||||||
|
|
||||||
def check(rx_message: MessageBase):
|
def check(rx_message: MessageBase):
|
||||||
|
Loading…
Reference in New Issue
Block a user