@@ -844,51 +844,41 @@ async def test_core_to_0_3_model_conversion(
844844 core_to_compat_push_notification_config_model
845845 )
846846
847- try :
848- task_id = 'v03-persistence-task'
849- config_id = 'c1'
850- original_config = TaskPushNotificationConfig (
851- id = config_id ,
852- url = 'https://example.com/push' ,
853- token = 'legacy-token' ,
854- )
855-
856- # 1. Save the config (will use core_to_compat_push_notification_config_model)
857- await store .set_info (task_id , original_config , MINIMAL_CALL_CONTEXT )
858-
859- # 2. Verify it's stored in v0.3 format directly in DB
860- async with store .async_session_maker () as session :
861- db_model = await session .get (
862- store .config_model , (task_id , config_id )
863- )
864- assert db_model is not None
865- assert db_model .protocol_version == '0.3'
866-
867- # v0.3 JSON structure for PushNotificationConfig (unwrapped)
868- import json
869-
870- raw_data = db_model .config_data
871- if store ._fernet :
872- raw_data = store ._fernet .decrypt (raw_data )
873- data = json .loads (raw_data .decode ('utf-8' ))
874- assert data ['url' ] == 'https://example.com/push'
875- assert data ['id' ] == 'c1'
876- assert data ['token' ] == 'legacy-token'
877- assert 'taskId' not in data
878-
879- # 3. Retrieve the config (will use compat_push_notification_config_model_to_core)
880- retrieved_configs = await store .get_info (task_id , MINIMAL_CALL_CONTEXT )
881- assert len (retrieved_configs ) == 1
882- retrieved = retrieved_configs [0 ]
883- assert retrieved .id == original_config .id
884- assert retrieved .url == original_config .url
885- assert retrieved .token == original_config .token
886-
887- finally :
888- # Reset conversion attributes
889- if assignment_type == 'class' :
890- DatabasePushNotificationConfigStore .core_to_model_conversion = None
891- else :
892- store .core_to_model_conversion = None
893-
894- await store .delete_info (task_id , MINIMAL_CALL_CONTEXT )
847+ task_id = 'v03-persistence-task'
848+ config_id = 'c1'
849+ original_config = TaskPushNotificationConfig (
850+ id = config_id ,
851+ url = 'https://example.com/push' ,
852+ token = 'legacy-token' ,
853+ )
854+ # 1. Save the config (will use core_to_compat_push_notification_config_model)
855+ await store .set_info (task_id , original_config , MINIMAL_CALL_CONTEXT )
856+ # 2. Verify it's stored in v0.3 format directly in DB
857+ async with store .async_session_maker () as session :
858+ db_model = await session .get (store .config_model , (task_id , config_id ))
859+ assert db_model is not None
860+ assert db_model .protocol_version == '0.3'
861+ # v0.3 JSON structure for PushNotificationConfig (unwrapped)
862+ import json
863+
864+ raw_data = db_model .config_data
865+ if store ._fernet :
866+ raw_data = store ._fernet .decrypt (raw_data )
867+ data = json .loads (raw_data .decode ('utf-8' ))
868+ assert data ['url' ] == 'https://example.com/push'
869+ assert data ['id' ] == 'c1'
870+ assert data ['token' ] == 'legacy-token'
871+ assert 'taskId' not in data
872+ # 3. Retrieve the config (will use compat_push_notification_config_model_to_core)
873+ retrieved_configs = await store .get_info (task_id , MINIMAL_CALL_CONTEXT )
874+ assert len (retrieved_configs ) == 1
875+ retrieved = retrieved_configs [0 ]
876+ assert retrieved .id == original_config .id
877+ assert retrieved .url == original_config .url
878+ assert retrieved .token == original_config .token
879+ # Reset conversion attributes
880+ if assignment_type == 'class' :
881+ DatabasePushNotificationConfigStore .core_to_model_conversion = None
882+ else :
883+ store .core_to_model_conversion = None
884+ await store .delete_info (task_id , MINIMAL_CALL_CONTEXT )
0 commit comments