@@ -68,6 +68,10 @@ async def user_info(request: Request):
6868 "identity" : user .identity ,
6969 "login" : user .login ,
7070 "instance" : user .instance ,
71+ "entity_class" : user .entity_class ,
72+ "entity_id" : user .entity_id ,
73+ "job_id" : user .job_id ,
74+ "application_id" : user .application_id ,
7175 }
7276 )
7377
@@ -523,6 +527,12 @@ def session_bfabric_session_has_required_fields(context, client):
523527 # Verify password content matches (not just length)
524528 assert session_data ["bfabric_auth_password" ] == token_data .user_ws_password .get_secret_value ()
525529
530+ # Verify token context fields
531+ assert session_data ["entity_class" ] == token_data .entity_class
532+ assert session_data ["entity_id" ] == token_data .entity_id
533+ assert session_data ["job_id" ] == token_data .job_id
534+ assert session_data ["application_id" ] == token_data .application_id
535+
526536
527537@then ("the hook should have received token data" )
528538def hook_received_token_data (context ):
@@ -664,3 +674,27 @@ def scope_user_instance(context, instance):
664674def websocket_scope_user_set (context ):
665675 """Check WebSocket scope has user set."""
666676 assert context ["websocket_response" ]["has_user" ] is True
677+
678+
679+ @then (parsers .parse ('the scope user entity_class should be "{value}"' ))
680+ def scope_user_entity_class (context , value ):
681+ """Check scope user entity_class."""
682+ assert context ["user_info" ]["entity_class" ] == value
683+
684+
685+ @then (parsers .parse ("the scope user entity_id should be {value:d}" ))
686+ def scope_user_entity_id (context , value ):
687+ """Check scope user entity_id."""
688+ assert context ["user_info" ]["entity_id" ] == value
689+
690+
691+ @then (parsers .parse ("the scope user job_id should be {value:d}" ))
692+ def scope_user_job_id (context , value ):
693+ """Check scope user job_id."""
694+ assert context ["user_info" ]["job_id" ] == value
695+
696+
697+ @then (parsers .parse ("the scope user application_id should be {value:d}" ))
698+ def scope_user_application_id (context , value ):
699+ """Check scope user application_id."""
700+ assert context ["user_info" ]["application_id" ] == value
0 commit comments