33
44from behave import given , then , when
55
6+ from archipy .configs .base_config import BaseConfig
67from archipy .helpers .utils .jwt_utils import JWTUtils
78from archipy .models .errors import InvalidTokenError , TokenExpiredError
89from features .test_helpers import get_current_scenario_context
@@ -18,7 +19,7 @@ def step_given_valid_user_uuid(context):
1819def step_when_access_token_created (context ):
1920 scenario_context = get_current_scenario_context (context )
2021 user_uuid = scenario_context .get ("user_uuid" )
21- test_config = scenario_context . get ( "test_config" )
22+ test_config = BaseConfig . global_config ( )
2223
2324 token = JWTUtils .create_access_token (user_uuid , auth_config = test_config .AUTH )
2425 scenario_context .store ("token" , token )
@@ -28,7 +29,7 @@ def step_when_access_token_created(context):
2829def step_when_refresh_token_created (context ):
2930 scenario_context = get_current_scenario_context (context )
3031 user_uuid = scenario_context .get ("user_uuid" )
31- test_config = scenario_context . get ( "test_config" )
32+ test_config = BaseConfig . global_config ( )
3233
3334 token = JWTUtils .create_refresh_token (user_uuid , auth_config = test_config .AUTH )
3435 scenario_context .store ("token" , token )
@@ -47,7 +48,7 @@ def step_then_jwt_token_returned(context):
4748def step_given_valid_access_token (context ):
4849 scenario_context = get_current_scenario_context (context )
4950 user_uuid = scenario_context .get ("user_uuid" )
50- test_config = scenario_context . get ( "test_config" )
51+ test_config = BaseConfig . global_config ( )
5152
5253 token = JWTUtils .create_access_token (user_uuid , auth_config = test_config .AUTH )
5354 scenario_context .store ("token" , token )
@@ -57,7 +58,7 @@ def step_given_valid_access_token(context):
5758def step_given_valid_refresh_token (context ):
5859 scenario_context = get_current_scenario_context (context )
5960 user_uuid = scenario_context .get ("user_uuid" )
60- test_config = scenario_context . get ( "test_config" )
61+ test_config = BaseConfig . global_config ( )
6162
6263 token = JWTUtils .create_refresh_token (user_uuid , auth_config = test_config .AUTH )
6364 scenario_context .store ("token" , token )
@@ -67,7 +68,7 @@ def step_given_valid_refresh_token(context):
6768def step_given_expired_access_token (context ):
6869 scenario_context = get_current_scenario_context (context )
6970 user_uuid = scenario_context .get ("user_uuid" )
70- test_config = scenario_context . get ( "test_config" )
71+ test_config = BaseConfig . global_config ( )
7172
7273 token = JWTUtils .create_access_token (
7374 user_uuid ,
@@ -87,7 +88,7 @@ def step_given_invalid_token(context):
8788def step_when_token_decoded (context ):
8889 scenario_context = get_current_scenario_context (context )
8990 token = scenario_context .get ("token" )
90- test_config = scenario_context . get ( "test_config" )
91+ test_config = BaseConfig . global_config ( )
9192
9293 try :
9394 decoded_payload = JWTUtils .decode_token (token , auth_config = test_config .AUTH )
0 commit comments