@@ -574,3 +574,42 @@ def test_ingest_data_file_cleanup_on_error(logbook_manager, mock_scilog, sample_
574574 # Despite the error, directory should exist (failed to clean up the file)
575575 # In this case we expect subdirectories to remain since file removal failed
576576 assert len (list (tmp_path .iterdir ())) > 0
577+
578+
579+ @pytest .mark .timeout (60 )
580+ @pytest .mark .parametrize (
581+ "width,height" ,
582+ [(800 , 600 ), (None , 600 ), (800 , None ), (None , None ), ("800px" , "600px" ), ("50%" , "50%" )],
583+ )
584+ def test_ingest_data_file_with_dimensions (
585+ logbook_manager , mock_scilog , sample_logbook , tmp_path , width , height
586+ ):
587+ """Test ingesting a file with dimensions (width and height)."""
588+ mock_scilog .get_logbooks .return_value = [sample_logbook ]
589+ mock_message = mock .Mock ()
590+ mock_scilog .new .return_value = mock_message
591+
592+ file_data = b"Test image content"
593+ msg = messages .MessagingServiceMessage (
594+ service_name = "scilog" ,
595+ message = [
596+ messages .MessagingServiceFileContent (
597+ filename = "image.png" ,
598+ data = file_data ,
599+ mime_type = "image/png" ,
600+ width = width ,
601+ height = height ,
602+ )
603+ ],
604+ scope = "deployment_scope" ,
605+ )
606+
607+ logbook_manager .ingest_data (msg , "logbook_123" )
608+
609+ # Verify add_file was called with dimensions
610+ assert mock_message .add_file .call_count == 1
611+ args , kwargs = mock_message .add_file .call_args
612+ if width is not None :
613+ assert "width" in kwargs and kwargs ["width" ] == width
614+ if height is not None :
615+ assert "height" in kwargs and kwargs ["height" ] == height
0 commit comments