From 554a21e1d07f3b434b5097b4e3d49e1403be7527 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Wed, 17 Jul 2019 10:38:45 +0200 Subject: [enh] Add Server-Timing header (#1637) Server Timing specification: https://www.w3.org/TR/server-timing/ In the browser Dev Tools, focus on the main request, there are the responses per engine in the Timing tab. --- tests/unit/test_webapp.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'tests/unit/test_webapp.py') diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py index fae1755d6..dcf8b583c 100644 --- a/tests/unit/test_webapp.py +++ b/tests/unit/test_webapp.py @@ -33,6 +33,19 @@ class ViewsTestCase(SearxTestCase): }, ] + timings = [ + { + 'engine': 'startpage', + 'total': 0.8, + 'load': 0.7 + }, + { + 'engine': 'youtube', + 'total': 0.9, + 'load': 0.6 + } + ] + def search_mock(search_self, *args): search_self.result_container = Mock(get_ordered_results=lambda: self.test_results, answers=set(), @@ -42,7 +55,8 @@ class ViewsTestCase(SearxTestCase): unresponsive_engines=set(), results=self.test_results, results_number=lambda: 3, - results_length=lambda: len(self.test_results)) + results_length=lambda: len(self.test_results), + get_timings=lambda: timings) Search.search = search_mock -- cgit v1.2.3