@@ -775,6 +775,7 @@ def test_sandbox_request_models_serialize_expected_wire_keys():
775775 image_name = "custom_node" ,
776776 input_sha256 = "abc123" ,
777777 input_size_bytes = 123 ,
778+ input_format = "rootfs_export_tar_gz" ,
778779 source_platform = "linux/amd64" ,
779780 image_config_user = "node" ,
780781 image_init = SandboxImageInit (
@@ -797,6 +798,7 @@ def test_sandbox_request_models_serialize_expected_wire_keys():
797798 assert CompleteSandboxImageBuildParams (
798799 input_sha256 = "abc123" ,
799800 input_size_bytes = 123 ,
801+ input_format = "rootfs_export_tar_gz" ,
800802 ).model_dump (by_alias = True , exclude_none = True ) == {
801803 "inputSha256" : "abc123" ,
802804 "inputSizeBytes" : 123 ,
@@ -946,8 +948,6 @@ def test_sync_sandbox_image_build_manager_uses_expected_wire_keys():
946948 "imageName" : "custom_node" ,
947949 "inputSha256" : "abc123" ,
948950 "inputSizeBytes" : 123 ,
949- "inputFormat" : "rootfs_export_tar_gz" ,
950- "sourcePlatform" : "linux/amd64" ,
951951 "imageConfigUser" : "node" ,
952952 "imageInit" : {"args" : ["node" , "server.js" ]},
953953 }
@@ -960,7 +960,6 @@ def test_sync_sandbox_image_build_manager_uses_expected_wire_keys():
960960 assert complete_call ["json" ] == {
961961 "inputSha256" : "abc123" ,
962962 "inputSizeBytes" : 123 ,
963- "inputFormat" : "rootfs_export_tar_gz" ,
964963 }
965964 assert cancel_call ["method" ] == "POST"
966965 assert cancel_call ["url" ].endswith ("/images/builds/build-123/cancel" )
@@ -1042,17 +1041,34 @@ def test_sync_sandbox_snapshot_and_image_build_list_contract(use_legacy_model):
10421041 ),
10431042 ],
10441043)
1045- def test_sync_image_build_defaults_serialize_for_dicts_and_legacy_models (params ):
1044+ def test_sync_image_build_omits_unspecified_fields_for_dicts_and_legacy_models (
1045+ params ,
1046+ ):
10461047 client = FakeSyncClient ()
1048+ manager = SandboxManager (client )
10471049
1048- SandboxManager (client ).create_image_build (params )
1050+ manager .create_image_build (params )
1051+ complete_params = (
1052+ {
1053+ "input_sha256" : "abc123" ,
1054+ "input_size_bytes" : 123 ,
1055+ }
1056+ if isinstance (params , dict )
1057+ else CompleteSandboxImageBuildParams (
1058+ input_sha256 = "abc123" ,
1059+ input_size_bytes = 123 ,
1060+ )
1061+ )
1062+ manager .complete_image_build ("build-123" , complete_params )
10491063
10501064 assert client .transport .client .calls [0 ]["json" ] == {
10511065 "imageName" : "custom_node" ,
10521066 "inputSha256" : "abc123" ,
10531067 "inputSizeBytes" : 123 ,
1054- "inputFormat" : "rootfs_export_tar_gz" ,
1055- "sourcePlatform" : "linux/amd64" ,
1068+ }
1069+ assert client .transport .client .calls [1 ]["json" ] == {
1070+ "inputSha256" : "abc123" ,
1071+ "inputSizeBytes" : 123 ,
10561072 }
10571073
10581074
@@ -1559,8 +1575,6 @@ async def test_async_sandbox_image_build_manager_uses_expected_wire_keys():
15591575 "imageName" : "custom_node" ,
15601576 "inputSha256" : "abc123" ,
15611577 "inputSizeBytes" : 123 ,
1562- "inputFormat" : "rootfs_export_tar_gz" ,
1563- "sourcePlatform" : "linux/amd64" ,
15641578 "imageConfigUser" : "node" ,
15651579 "imageInit" : {"args" : ["node" , "server.js" ]},
15661580 }
@@ -1573,7 +1587,6 @@ async def test_async_sandbox_image_build_manager_uses_expected_wire_keys():
15731587 assert complete_call ["json" ] == {
15741588 "inputSha256" : "abc123" ,
15751589 "inputSizeBytes" : 123 ,
1576- "inputFormat" : "rootfs_export_tar_gz" ,
15771590 }
15781591 assert cancel_call ["method" ] == "POST"
15791592 assert cancel_call ["url" ].endswith ("/images/builds/build-123/cancel" )
0 commit comments