File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 44
55from ellar .common import IModuleSetup , Module
66from ellar .core import Config , ModuleSetup
7- from ellar .core .modules import DynamicModule , ModuleBase
7+ from ellar .core .modules import DynamicModule , ModuleBase , ModuleRefBase
88from ellar .di import ProviderConfig
99from pydantic import AnyHttpUrl
1010
@@ -53,13 +53,11 @@ def register_setup(cls) -> ModuleSetup:
5353 return ModuleSetup (cls , inject = [Config ], factory = cls .register_setup_factory )
5454
5555 @staticmethod
56- def register_setup_factory (
57- module : t .Type ["JWTModule" ], config : Config
58- ) -> DynamicModule :
56+ def register_setup_factory (module : ModuleRefBase , config : Config ) -> DynamicModule :
5957 if config .get ("JWT_CONFIG" ) and isinstance (config .JWT_CONFIG , dict ):
6058 schema = JWTConfiguration (** dict (config .JWT_CONFIG ))
6159 return DynamicModule (
62- module ,
60+ module . module ,
6361 providers = [
6462 JWTService ,
6563 ProviderConfig (JWTConfiguration , use_value = schema ),
Original file line number Diff line number Diff line change @@ -21,10 +21,10 @@ def test_jwt_module_configuration_case_1():
2121 )
2222 jwt_service : JWTService = tm .get (JWTService )
2323
24- token = jwt_service .sign ({"sub" : 23 })
24+ token = jwt_service .sign ({"sub" : "23" })
2525 payload = jwt_service .decode (token )
2626
27- assert payload ["sub" ] == 23
27+ assert payload ["sub" ] == "23"
2828
2929
3030def test_jwt_module_configuration_case_2 ():
@@ -42,10 +42,10 @@ def test_jwt_module_configuration_case_2():
4242 )
4343 jwt_service : JWTService = tm .get (JWTService )
4444
45- token = jwt_service .sign ({"sub" : 23 })
45+ token = jwt_service .sign ({"sub" : "23" })
4646 payload = jwt_service .decode (token )
4747
48- assert payload ["sub" ] == 23
48+ assert payload ["sub" ] == "23"
4949
5050
5151def test_jwt_module_configuration_case_2_fails ():
You can’t perform that action at this time.
0 commit comments