Reduce polling request log noise
This commit is contained in:
+22
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user