File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 4242class PyJWT :
4343 def __init__ (self , options : Options | None = None ) -> None :
4444 self .options : FullOptions
45- if options is None :
46- self .options = self ._get_default_options ()
47- else :
48- self .options = {** self ._get_default_options (), ** options }
45+ self .options = self ._get_default_options ()
46+ if options is not None :
47+ self .options = self ._merge_options (options )
4948
5049 @staticmethod
5150 def _get_default_options () -> FullOptions :
Original file line number Diff line number Diff line change @@ -36,6 +36,14 @@ def payload():
3636
3737
3838class TestJWT :
39+ def test_jwt_with_options (self ):
40+ jwt = PyJWT (options = {"verify_signature" : False })
41+ assert jwt .options ["verify_signature" ] is False
42+ # assert that unrelated option is unchanged from default
43+ assert jwt .options ["strict_aud" ] is False
44+ # assert that verify_signature is respected unless verify_exp is overridden
45+ assert jwt .options ["verify_exp" ] is False
46+
3947 def test_decodes_valid_jwt (self , jwt ):
4048 example_payload = {"hello" : "world" }
4149 example_secret = "secret"
You can’t perform that action at this time.
0 commit comments