summaryrefslogtreecommitdiff
path: root/tests/integration/test_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/test_config.py')
-rw-r--r--tests/integration/test_config.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/integration/test_config.py b/tests/integration/test_config.py
index 2f6bdc4..fe5cf9d 100644
--- a/tests/integration/test_config.py
+++ b/tests/integration/test_config.py
@@ -49,3 +49,24 @@ class AListenLineThatDoesNotParse(unittest.TestCase):
49 49
50 def test_so_does_an_option_it_does_not_know(self): 50 def test_so_does_an_option_it_does_not_know(self):
51 self.assertIn("want an address", self.refuses("listen.tcp 127.0.0.1:7999 wokers=2\n")) 51 self.assertIn("want an address", self.refuses("listen.tcp 127.0.0.1:7999 wokers=2\n"))
52
53
54class EmptyTorrentTimeout(TrackerTestCase):
55 config = "tracker.empty_torrent_timeout 60\n"
56
57 def test_the_tracker_accepts_the_option_and_serves(self):
58 self.assertEqual(self.tracker.announce(self.hash_for("emptyto"))[b"complete"], 1)
59 self.assertNotIn("Unhandled line", self.tracker.output())
60 self.assertNotIn("Parse error", self.tracker.output())
61
62
63class EmptyTorrentTimeoutThatDoesNotParse(unittest.TestCase):
64 def test_a_non_numeric_value_warns_but_the_tracker_serves(self):
65 """A scalar that will not parse warns and is ignored, unlike a listen
66 line, which stops the tracker."""
67 tracker = Tracker("tracker.empty_torrent_timeout later\n")
68 try:
69 self.assertEqual(tracker.announce(b"emptytobad\0\0\0\0\0\0\0\0\0\0")[b"complete"], 1)
70 self.assertIn("Parse error", tracker.output())
71 finally:
72 tracker._cleanup()