File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 11# Copyright 2021 ACSONE SA/NV
22# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
33
4+ import logging
45import time
56
67import jwt
@@ -45,7 +46,16 @@ def test_whoami(self):
4546 # Try again in a user session, it will be rejected because auth_jwt
4647 # is not designed to work in user session.
4748 self .authenticate ("demo" , "demo" )
48- resp = self .url_open ("/auth_jwt_demo/whoami" , headers = {"Authorization" : token })
49+ with self .assertLogs ("odoo.addons.auth_jwt.models.ir_http" , "WARNING" ) as logs :
50+ resp = self .url_open (
51+ "/auth_jwt_demo/whoami" , headers = {"Authorization" : token }
52+ )
53+ self .assertEqual (len (logs .records ), 1 )
54+ self .assertEqual (logs .records [0 ].levelno , logging .WARNING )
55+ self .assertIn (
56+ 'A route with auth="jwt" must not be used within a user session' ,
57+ logs .output [0 ],
58+ )
4959 self .assertEqual (resp .status_code , 401 )
5060
5161 def test_whoami_cookie (self ):
You can’t perform that action at this time.
0 commit comments