File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 1
1
import logging
2
+ import logging .config
2
3
import sys
3
4
import time
4
5
from datetime import datetime
47
48
48
49
summary_logger = logging .getLogger ("request.summary" )
49
50
51
+
50
52
@app .get ("/" , include_in_schema = False )
51
53
def root (request : Request ):
52
54
"""GET via root redirects to /docs.
Original file line number Diff line number Diff line change @@ -6,3 +6,14 @@ def test_read_root(anon_client):
6
6
prev_resp = resp .history [0 ]
7
7
assert prev_resp .status_code == 307 # Temporary Redirect
8
8
assert prev_resp .headers ["location" ] == "./docs"
9
+
10
+
11
+ def test_request_summary_is_logged (anon_client , caplog ):
12
+ anon_client .get ("/__lbheartbeat__" )
13
+
14
+ summary = caplog .records [- 1 ]
15
+
16
+ assert summary .name == "request.summary"
17
+ assert summary .method == "GET"
18
+ assert summary .path == "/__lbheartbeat__"
19
+ assert summary .querystring == {}
You can’t perform that action at this time.
0 commit comments