Reduce polling request log noise

This commit is contained in:
Dymas
2026-05-17 21:20:24 +02:00
parent ae090c954b
commit d0af0258f2
6 changed files with 34 additions and 3 deletions
+22
View File
@@ -1408,6 +1408,28 @@ class HandlerRouteTests(unittest.TestCase):
class TemplateHelperTests(unittest.TestCase):
def test_log_message_skips_queue_poll_requests(self):
handler = object.__new__(APP.Handler)
handler.path = "/api/queue?page=1&per_page=10"
handler.command = "GET"
handler.address_string = lambda: "127.0.0.1"
with mock.patch("builtins.print") as print_mock:
APP.Handler.log_message(handler, '"GET /api/queue?page=1&per_page=10 HTTP/1.1" %s -', 200)
print_mock.assert_not_called()
def test_log_message_keeps_non_poll_requests(self):
handler = object.__new__(APP.Handler)
handler.path = "/api/config"
handler.command = "GET"
handler.address_string = lambda: "127.0.0.1"
with mock.patch("builtins.print") as print_mock:
APP.Handler.log_message(handler, '"GET /api/config HTTP/1.1" %s -', 200)
print_mock.assert_called_once()
def test_page_links_marks_active_page(self):
markup = APP.render_page_links("config")
self.assertIn('class="page-link active" href="/config"', markup)