File tree Expand file tree Collapse file tree 2 files changed +70
-4
lines changed
tests/unit/module_utils/test_data/build_query_params_no_child Expand file tree Collapse file tree 2 files changed +70
-4
lines changed Original file line number Diff line number Diff line change @@ -665,10 +665,6 @@ def _build_query_params(
665
665
}
666
666
query_dict .update (rear_port )
667
667
668
- elif parent == "interface_template" or parent == "device_bay_template" :
669
- if query_dict .get ("device_type" ):
670
- query_dict ["devicetype_id" ] = query_dict .pop ("device_type" )
671
-
672
668
elif parent == "rear_port_template" and self .endpoint == "front_port_templates" :
673
669
if isinstance (module_data .get ("rear_port_template" ), str ):
674
670
rear_port_template = {
@@ -677,6 +673,10 @@ def _build_query_params(
677
673
}
678
674
query_dict .update (rear_port_template )
679
675
676
+ elif "_template" in parent :
677
+ if query_dict .get ("device_type" ):
678
+ query_dict ["devicetype_id" ] = query_dict .pop ("device_type" )
679
+
680
680
query_dict = self ._convert_identical_keys (query_dict )
681
681
return query_dict
682
682
Original file line number Diff line number Diff line change 330
330
"devicetype_id" : 1
331
331
}
332
332
},
333
+ {
334
+ "parent" : " console_port_template" ,
335
+ "module_data" : {
336
+ "name" : " CP 1" ,
337
+ "device_type" : 1
338
+ },
339
+ "expected" : {
340
+ "name" : " CP 1" ,
341
+ "devicetype_id" : 1
342
+ }
343
+ },
344
+ {
345
+ "parent" : " console_server_port_template" ,
346
+ "module_data" : {
347
+ "name" : " CP - Server 1" ,
348
+ "device_type" : 1
349
+ },
350
+ "expected" : {
351
+ "name" : " CP - Server 1" ,
352
+ "devicetype_id" : 1
353
+ }
354
+ },
355
+ {
356
+ "parent" : " interface_template" ,
357
+ "module_data" : {
358
+ "name" : " Dev Intf 1" ,
359
+ "device_type" : 1
360
+ },
361
+ "expected" : {
362
+ "name" : " Dev Intf 1" ,
363
+ "devicetype_id" : 1
364
+ }
365
+ },
366
+ {
367
+ "parent" : " front_port_template" ,
368
+ "module_data" : {
369
+ "name" : " FP 1" ,
370
+ "device_type" : 1
371
+ },
372
+ "expected" : {
373
+ "name" : " FP 1" ,
374
+ "devicetype_id" : 1
375
+ }
376
+ },
377
+ {
378
+ "parent" : " power_outlet_template" ,
379
+ "module_data" : {
380
+ "name" : " PO 1" ,
381
+ "device_type" : 1
382
+ },
383
+ "expected" : {
384
+ "name" : " PO 1" ,
385
+ "devicetype_id" : 1
386
+ }
387
+ },
388
+ {
389
+ "parent" : " power_port_template" ,
390
+ "module_data" : {
391
+ "name" : " PP 1" ,
392
+ "device_type" : 1
393
+ },
394
+ "expected" : {
395
+ "name" : " PP 1" ,
396
+ "devicetype_id" : 1
397
+ }
398
+ },
333
399
{
334
400
"parent" : " virtual_machine" ,
335
401
"module_data" : {
You can’t perform that action at this time.
0 commit comments