summaryrefslogtreecommitdiff
path: root/tests/integration/test_udp.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/test_udp.py')
-rw-r--r--tests/integration/test_udp.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/integration/test_udp.py b/tests/integration/test_udp.py
index 3afe4ef..b60bd56 100644
--- a/tests/integration/test_udp.py
+++ b/tests/integration/test_udp.py
@@ -44,6 +44,17 @@ class UdpProtocol(TrackerTestCase):
44 self.assertEqual(action, 3, "action 3 is the error packet") 44 self.assertEqual(action, 3, "action 3 is the error packet")
45 self.assertIn(b"Connection ID missmatch", answer[8:]) 45 self.assertIn(b"Connection ID missmatch", answer[8:])
46 46
47 def test_a_wrong_connection_id_is_not_answered_with_more_than_was_sent(self):
48 """The sender's address is unverified at this point, so the error
49 must not be a way to throw bytes at somebody else."""
50 scrape = struct.pack(">QII", 0, 2, 3) + self.hash_for("udpbadscrape")
51 answer = self.tracker.udp_raw(scrape)
52 self.assertIsNotNone(answer, "a whole scrape is long enough to be told")
53 self.assertLessEqual(len(answer), len(scrape))
54 self.assertIsNone(self.tracker.udp_raw(scrape[:16]))
55 self.assertIsNone(self.tracker.udp_raw(scrape[: len(answer) - 1]))
56 self.assertIsNotNone(self.tracker.udp_raw(scrape[: len(answer)]))
57
47 def test_a_packet_shorter_than_the_header_is_ignored(self): 58 def test_a_packet_shorter_than_the_header_is_ignored(self):
48 self.assertIsNone(self.tracker.udp_raw(b"\x00" * 15)) 59 self.assertIsNone(self.tracker.udp_raw(b"\x00" * 15))
49 60