@@ -138,6 +138,54 @@ mod tests {
138138 . await ;
139139 }
140140
141+ #[ tokio:: test]
142+ async fn mapper_replaces_remote_url_with_proxy_url_3545 ( ) {
143+ let ttd = TempTedgeDir :: new ( ) ;
144+ let config = C8yMapperConfig {
145+ c8y_host : "my.custom.domain.com:443" . into ( ) ,
146+ c8y_mqtt : "t12345.cumulocity.com:8883" . into ( ) ,
147+ ..test_mapper_config ( & ttd)
148+ } ;
149+ let test_handle = spawn_c8y_mapper_actor_with_config ( & ttd, config, true ) . await ;
150+ let TestHandle { mqtt, .. } = test_handle;
151+ let mut mqtt = mqtt. with_timeout ( TEST_TIMEOUT_MS ) ;
152+
153+ skip_init_messages ( & mut mqtt) . await ;
154+
155+ // Simulate c8y_DownloadConfigFile operation delivered via JSON over MQTT
156+ mqtt. send ( MqttMessage :: new (
157+ & C8yDeviceControlTopic :: topic ( & "c8y" . try_into ( ) . unwrap ( ) ) ,
158+ json ! ( {
159+ "id" : "123456" ,
160+ "c8y_DownloadConfigFile" : {
161+ "type" : "path/config/A" ,
162+ "url" : "https://t12345.cumulocity.com/inventory/binaries/654321"
163+ } ,
164+ "externalSource" : {
165+ "externalId" : "test-device" ,
166+ "type" : "c8y_Serial"
167+ }
168+ } )
169+ . to_string ( ) ,
170+ ) )
171+ . await
172+ . expect ( "Send failed" ) ;
173+
174+ assert_received_includes_json (
175+ & mut mqtt,
176+ [ (
177+ "te/device/main///cmd/config_update/c8y-mapper-123456" ,
178+ json ! ( {
179+ "status" : "init" ,
180+ "remoteUrl" : "http://127.0.0.1:8001/c8y/inventory/binaries/654321" ,
181+ "serverUrl" : "https://t12345.cumulocity.com/inventory/binaries/654321" ,
182+ "type" : "path/config/A" ,
183+ } ) ,
184+ ) ] ,
185+ )
186+ . await ;
187+ }
188+
141189 #[ tokio:: test]
142190 async fn mapper_converts_config_download_op_for_child_device ( ) {
143191 let ttd = TempTedgeDir :: new ( ) ;
0 commit comments