summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/test_config.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/integration/test_config.py b/tests/integration/test_config.py
index 1a84fa7..2f6bdc4 100644
--- a/tests/integration/test_config.py
+++ b/tests/integration/test_config.py
@@ -1,7 +1,9 @@
1"""Settings the tracker has to accept, and still work with. 1"""Settings the tracker has to accept, and still work with.
2 2
3An unrecognised key makes opentracker refuse to start, so a test that it 3An unrecognised key only warns, so coming up proves nothing on its own and a
4comes up at all is a test that the key was understood. 4test that cares has to look at what the tracker said. A key that is
5recognised but cannot be parsed is another matter, and for the listen
6statements it stops the tracker.
5""" 7"""
6 8
7import unittest 9import unittest
@@ -14,6 +16,7 @@ class TcpWorkers(TrackerTestCase):
14 16
15 def test_the_tracker_serves_with_tcp_workers_asked_for(self): 17 def test_the_tracker_serves_with_tcp_workers_asked_for(self):
16 self.assertEqual(self.tracker.announce(self.hash_for("tcpworkers"))[b"complete"], 1) 18 self.assertEqual(self.tracker.announce(self.hash_for("tcpworkers"))[b"complete"], 1)
19 self.assertNotIn("Unhandled line", self.tracker.output())
17 20
18 21
19class WorkersOnAListenStatement(unittest.TestCase): 22class WorkersOnAListenStatement(unittest.TestCase):
@@ -27,3 +30,22 @@ class WorkersOnAListenStatement(unittest.TestCase):
27 self.assertEqual(complaints, [], "the tracker reported:\n" + "\n".join(complaints)) 30 self.assertEqual(complaints, [], "the tracker reported:\n" + "\n".join(complaints))
28 finally: 31 finally:
29 tracker._cleanup() 32 tracker._cleanup()
33
34
35class AListenLineThatDoesNotParse(unittest.TestCase):
36 """Warning and carrying on left a tracker that had been told where to
37 listen coming up on its default instead, which is every interface."""
38
39 def refuses(self, line):
40 with self.assertRaises(AssertionError) as caught:
41 Tracker(line)
42 return str(caught.exception)
43
44 def test_an_address_that_is_not_one_stops_the_tracker(self):
45 self.assertIn("want an address", self.refuses("listen.tcp 10.0.0.300:7999\n"))
46
47 def test_so_does_a_port_out_of_range(self):
48 self.assertIn("want an address", self.refuses("listen.udp 127.0.0.1:99999\n"))
49
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"))