From ba95d046f9a568a2fd9de337ce7ffd1f567324e7 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Mon, 4 Sep 2023 04:58:02 +0300 Subject: [PATCH] Run listener with a large time offset and ensure it's not connected --- minode/tests/test_network.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/minode/tests/test_network.py b/minode/tests/test_network.py index 8f70a96..1fdccb9 100644 --- a/minode/tests/test_network.py +++ b/minode/tests/test_network.py @@ -198,6 +198,19 @@ class TestListener(TestProcessProto): self.assertFalse(listener.is_alive()) + def test_listener_timeoffset(self): + """Run listener with a large time offset - shouldn't connect""" + with time_offset(4000): + with run_listener() as listener: + if not listener: + self.fail('Failed to start listener') + shared.connection_limit = 2 + for _ in range(30): + for c in shared.connections: + if c.status == 'fully_established': + self.fail('Established a connection') + time.sleep(0.5) + @classmethod def tearDownClass(cls): super().tearDownClass()