diff options
Diffstat (limited to 'tests/integration/test_stats.py')
| -rw-r--r-- | tests/integration/test_stats.py | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/tests/integration/test_stats.py b/tests/integration/test_stats.py index 820b917..088d8a1 100644 --- a/tests/integration/test_stats.py +++ b/tests/integration/test_stats.py | |||
| @@ -15,10 +15,10 @@ import xml.etree.ElementTree | |||
| 15 | from harness import TrackerTestCase | 15 | from harness import TrackerTestCase |
| 16 | 16 | ||
| 17 | # The modes a default build answers. "tpbs" and "statedump" are full scrapes | 17 | # The modes a default build answers. "tpbs" and "statedump" are full scrapes |
| 18 | # and belong to test_fullscrape; "fulllog" and "woodpeckers" sit behind | 18 | # and belong to test_fullscrape; "woodpeckers" sits behind a |
| 19 | # feature flags this build does not set. | 19 | # feature flag this build does not set. |
| 20 | MRTG_MODES = ["peer", "conn", "scrp", "udp4", "tcp4", "torr", "fscr", "completed", "syncs"] | 20 | MRTG_MODES = ["peer", "conn", "scrp", "udp4", "tcp4", "torr", "fscr", "completed", "syncs"] |
| 21 | TEXT_MODES = ["herr", "s24s", "top10", "top100", "renew", "version"] | 21 | TEXT_MODES = ["herr", "s24s", "top10", "top100", "renew"] |
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | class StatsShape(TrackerTestCase): | 24 | class StatsShape(TrackerTestCase): |
| @@ -55,9 +55,22 @@ class StatsShape(TrackerTestCase): | |||
| 55 | self.assertIsNotNone(root.find("torrents/count_mutex")) | 55 | self.assertIsNotNone(root.find("torrents/count_mutex")) |
| 56 | self.assertIsNotNone(root.find("connections/tcp/announce")) | 56 | self.assertIsNotNone(root.find("connections/tcp/announce")) |
| 57 | 57 | ||
| 58 | def test_version_names_a_commit(self): | 58 | def test_the_version_mode_is_gone(self): |
| 59 | self.assertIn(b"opentracker", self.tracker.stats("version").lower() + b"opentracker") | 59 | """Which build a tracker is and what went into it is of use to whoever |
| 60 | self.assertRegex(self.tracker.stats("version"), rb"https?://") | 60 | attacks it and to nobody else on the far end of a socket. It is |
| 61 | reported by -v, to whoever already has the binary.""" | ||
| 62 | with self.assertRaises(urllib.error.HTTPError) as caught: | ||
| 63 | self.tracker.stats("version") | ||
| 64 | self.assertEqual(caught.exception.code, 400, "an unknown mode, like any other") | ||
| 65 | |||
| 66 | def test_everything_does_not_name_the_build(self): | ||
| 67 | self.assertNotIn(b"opentracker 1", self.tracker.stats("everything")) | ||
| 68 | |||
| 69 | def test_everything_does_not_name_the_tracker_id(self): | ||
| 70 | """The id a tracker recognises its own live sync packets by. Knowing | ||
| 71 | it is of no use to a client and of some use to whoever would like a | ||
| 72 | tracker to discard what it is told.""" | ||
| 73 | self.assertNotIn(b"tracker_id", self.tracker.stats("everything")) | ||
| 61 | 74 | ||
| 62 | 75 | ||
| 63 | class StatsCount(TrackerTestCase): | 76 | class StatsCount(TrackerTestCase): |
