@@ -188,7 +188,7 @@ def test_muxcable_status(self):
188
188
db = Db ()
189
189
result = runner .invoke (show .cli .commands ["muxcable" ].commands ["status" ], obj = db )
190
190
191
- assert result .exit_code == 102
191
+ assert result .exit_code == 0
192
192
assert result .output == tabular_data_status_output_expected
193
193
194
194
def test_muxcable_status_json (self ):
@@ -197,7 +197,7 @@ def test_muxcable_status_json(self):
197
197
198
198
result = runner .invoke (show .cli .commands ["muxcable" ].commands ["status" ], ["--json" ], obj = db )
199
199
200
- assert result .exit_code == 102
200
+ assert result .exit_code == 0
201
201
assert result .output == json_data_status_output_expected
202
202
203
203
def test_muxcable_status_config (self ):
@@ -206,7 +206,7 @@ def test_muxcable_status_config(self):
206
206
207
207
result = runner .invoke (show .cli .commands ["muxcable" ].commands ["config" ], obj = db )
208
208
209
- assert result .exit_code == 101
209
+ assert result .exit_code == 0
210
210
assert result .output == tabular_data_config_output_expected
211
211
212
212
def test_muxcable_status_config_json (self ):
@@ -215,7 +215,7 @@ def test_muxcable_status_config_json(self):
215
215
216
216
result = runner .invoke (show .cli .commands ["muxcable" ].commands ["config" ], ["--json" ], obj = db )
217
217
218
- assert result .exit_code == 101
218
+ assert result .exit_code == 0
219
219
assert result .output == json_data_status_config_output_expected
220
220
221
221
def test_muxcable_config_json_with_incorrect_port (self ):
@@ -233,7 +233,7 @@ def test_muxcable_status_json_with_correct_port(self):
233
233
patched_util .SfpUtilHelper .return_value .get_asic_id_for_logical_port .return_value = 0
234
234
result = runner .invoke (show .cli .commands ["muxcable" ].commands ["status" ], ["Ethernet0" , "--json" ], obj = db )
235
235
236
- assert result .exit_code == 102
236
+ assert result .exit_code == 0
237
237
238
238
def test_muxcable_status_json_port_incorrect_index (self ):
239
239
runner = CliRunner ()
@@ -266,7 +266,7 @@ def test_muxcable_config_with_correct_port(self):
266
266
patched_util .SfpUtilHelper .return_value .get_asic_id_for_logical_port .return_value = 0
267
267
result = runner .invoke (show .cli .commands ["muxcable" ].commands ["config" ], ["Ethernet0" ], obj = db )
268
268
269
- assert result .exit_code == 101
269
+ assert result .exit_code == 0
270
270
271
271
def test_muxcable_config_json_with_correct_port (self ):
272
272
runner = CliRunner ()
@@ -275,7 +275,7 @@ def test_muxcable_config_json_with_correct_port(self):
275
275
patched_util .SfpUtilHelper .return_value .get_asic_id_for_logical_port .return_value = 0
276
276
result = runner .invoke (show .cli .commands ["muxcable" ].commands ["config" ], ["Ethernet0" , "--json" ], obj = db )
277
277
278
- assert result .exit_code == 101
278
+ assert result .exit_code == 0
279
279
280
280
def test_muxcable_config_json_port_with_incorrect_index (self ):
281
281
runner = CliRunner ()
@@ -284,7 +284,7 @@ def test_muxcable_config_json_port_with_incorrect_index(self):
284
284
patched_util .SfpUtilHelper .return_value .get_asic_id_for_logical_port .return_value = 1
285
285
result = runner .invoke (show .cli .commands ["muxcable" ].commands ["config" ], ["Ethernet0" , "--json" ], obj = db )
286
286
287
- assert result .exit_code == 101
287
+ assert result .exit_code == 0
288
288
289
289
def test_muxcable_config_json_with_incorrect_port_patch (self ):
290
290
runner = CliRunner ()
@@ -302,7 +302,7 @@ def test_muxcable_status_json_port_eth0(self):
302
302
patched_util .SfpUtilHelper .return_value .get_asic_id_for_logical_port .return_value = 0
303
303
result = runner .invoke (show .cli .commands ["muxcable" ].commands ["status" ], ["Ethernet0" ], obj = db )
304
304
305
- assert result .exit_code == 102
305
+ assert result .exit_code == 0
306
306
307
307
def test_config_muxcable_tabular_port_Ethernet8_active (self ):
308
308
runner = CliRunner ()
@@ -312,7 +312,7 @@ def test_config_muxcable_tabular_port_Ethernet8_active(self):
312
312
patched_util .SfpUtilHelper .return_value .get_asic_id_for_logical_port .return_value = 0
313
313
result = runner .invoke (config .config .commands ["muxcable" ].commands ["mode" ], ["active" , "Ethernet8" ], obj = db )
314
314
315
- assert result .exit_code == 100
315
+ assert result .exit_code == 0
316
316
317
317
def test_config_muxcable_tabular_port_Ethernet8_auto (self ):
318
318
runner = CliRunner ()
@@ -322,15 +322,15 @@ def test_config_muxcable_tabular_port_Ethernet8_auto(self):
322
322
patched_util .SfpUtilHelper .return_value .get_asic_id_for_logical_port .return_value = 0
323
323
result = runner .invoke (config .config .commands ["muxcable" ].commands ["mode" ], ["auto" , "Ethernet8" ], obj = db )
324
324
325
- assert result .exit_code == 100
325
+ assert result .exit_code == 0
326
326
327
327
def test_config_muxcable_mode_auto_json (self ):
328
328
runner = CliRunner ()
329
329
db = Db ()
330
330
331
331
result = runner .invoke (config .config .commands ["muxcable" ].commands ["mode" ], ["auto" , "all" , "--json" ], obj = db )
332
332
333
- assert result .exit_code == 100
333
+ assert result .exit_code == 0
334
334
assert result .output == json_data_config_output_auto_expected
335
335
336
336
def test_config_muxcable_mode_active_json (self ):
@@ -341,7 +341,7 @@ def test_config_muxcable_mode_active_json(self):
341
341
f = open ("newfile1" , "w" )
342
342
f .write (result .output )
343
343
344
- assert result .exit_code == 100
344
+ assert result .exit_code == 0
345
345
assert result .output == json_data_config_output_active_expected
346
346
347
347
def test_config_muxcable_json_port_auto_Ethernet0 (self ):
@@ -353,7 +353,7 @@ def test_config_muxcable_json_port_auto_Ethernet0(self):
353
353
result = runner .invoke (config .config .commands ["muxcable" ].commands ["mode" ], [
354
354
"auto" , "Ethernet0" , "--json" ], obj = db )
355
355
356
- assert result .exit_code == 100
356
+ assert result .exit_code == 0
357
357
358
358
def test_config_muxcable_json_port_active_Ethernet0 (self ):
359
359
runner = CliRunner ()
@@ -364,13 +364,13 @@ def test_config_muxcable_json_port_active_Ethernet0(self):
364
364
result = runner .invoke (config .config .commands ["muxcable" ].commands ["mode" ], [
365
365
"active" , "Ethernet0" , "--json" ], obj = db )
366
366
367
- assert result .exit_code == 100
367
+ assert result .exit_code == 0
368
368
369
369
def test_config_muxcable_mode_auto_tabular (self ):
370
370
runner = CliRunner ()
371
371
db = Db ()
372
372
result = runner .invoke (config .config .commands ["muxcable" ].commands ["mode" ], ["auto" , "all" ], obj = db )
373
- assert result .exit_code == 100
373
+ assert result .exit_code == 0
374
374
375
375
def test_config_muxcable_mode_active_tabular (self ):
376
376
runner = CliRunner ()
@@ -380,7 +380,7 @@ def test_config_muxcable_mode_active_tabular(self):
380
380
f = open ("newfile" , "w" )
381
381
f .write (result .output )
382
382
383
- assert result .exit_code == 100
383
+ assert result .exit_code == 0
384
384
385
385
def test_config_muxcable_tabular_port (self ):
386
386
runner = CliRunner ()
@@ -390,7 +390,7 @@ def test_config_muxcable_tabular_port(self):
390
390
patched_util .SfpUtilHelper .return_value .get_asic_id_for_logical_port .return_value = 0
391
391
result = runner .invoke (config .config .commands ["muxcable" ].commands ["mode" ], ["active" , "Ethernet0" ], obj = db )
392
392
393
- assert result .exit_code == 100
393
+ assert result .exit_code == 0
394
394
395
395
def test_config_muxcable_tabular_port_Ethernet4_active (self ):
396
396
runner = CliRunner ()
@@ -400,7 +400,7 @@ def test_config_muxcable_tabular_port_Ethernet4_active(self):
400
400
patched_util .SfpUtilHelper .return_value .get_asic_id_for_logical_port .return_value = 0
401
401
result = runner .invoke (config .config .commands ["muxcable" ].commands ["mode" ], ["active" , "Ethernet4" ], obj = db )
402
402
403
- assert result .exit_code == 100
403
+ assert result .exit_code == 0
404
404
405
405
def test_config_muxcable_tabular_port_Ethernet4_auto (self ):
406
406
runner = CliRunner ()
@@ -410,7 +410,7 @@ def test_config_muxcable_tabular_port_Ethernet4_auto(self):
410
410
patched_util .SfpUtilHelper .return_value .get_asic_id_for_logical_port .return_value = 0
411
411
result = runner .invoke (config .config .commands ["muxcable" ].commands ["mode" ], ["auto" , "Ethernet4" ], obj = db )
412
412
413
- assert result .exit_code == 100
413
+ assert result .exit_code == 0
414
414
415
415
def test_config_muxcable_tabular_port_with_incorrect_index (self ):
416
416
runner = CliRunner ()
@@ -475,7 +475,7 @@ def test_config_muxcable_enable_prbs(self):
475
475
result = runner .invoke (config .config .commands ["muxcable" ].commands ["prbs" ].commands ["enable" ],
476
476
["0" , "0" , "0" , "0" ], obj = db )
477
477
478
- assert result .exit_code == 100
478
+ assert result .exit_code == 0
479
479
480
480
@mock .patch ('os.geteuid' , mock .MagicMock (return_value = 0 ))
481
481
@mock .patch ('sonic_y_cable.y_cable.enable_loopback_mode' , mock .MagicMock (return_value = 1 ))
@@ -486,7 +486,7 @@ def test_config_muxcable_enable_loopback(self):
486
486
result = runner .invoke (config .config .commands ["muxcable" ].commands ["loopback" ].commands ["enable" ],
487
487
["0" , "0" , "0" ], obj = db )
488
488
489
- assert result .exit_code == 100
489
+ assert result .exit_code == 0
490
490
491
491
@mock .patch ('os.geteuid' , mock .MagicMock (return_value = 0 ))
492
492
@mock .patch ('sonic_y_cable.y_cable.disable_prbs_mode' , mock .MagicMock (return_value = 1 ))
@@ -497,7 +497,7 @@ def test_config_muxcable_disble_prbs(self):
497
497
result = runner .invoke (config .config .commands ["muxcable" ].commands ["prbs" ].commands ["disable" ],
498
498
["0" , "0" ], obj = db )
499
499
500
- assert result .exit_code == 100
500
+ assert result .exit_code == 0
501
501
502
502
@mock .patch ('os.geteuid' , mock .MagicMock (return_value = 0 ))
503
503
@mock .patch ('sonic_y_cable.y_cable.disable_loopback_mode' , mock .MagicMock (return_value = 1 ))
@@ -508,7 +508,7 @@ def test_config_muxcable_disable_loopback(self):
508
508
result = runner .invoke (config .config .commands ["muxcable" ].commands ["loopback" ].commands ["disable" ],
509
509
["0" , "0" ], obj = db )
510
510
511
- assert result .exit_code == 100
511
+ assert result .exit_code == 0
512
512
513
513
@mock .patch ('sonic_y_cable.y_cable.get_part_number' , mock .MagicMock (return_value = ("CACL1X321P2PA1M" )))
514
514
@mock .patch ('sonic_y_cable.y_cable.get_vendor' , mock .MagicMock (return_value = ("Credo " )))
@@ -567,6 +567,7 @@ def test_show_muxcable_cableinfo_incorrect_logical_port_return_value(self):
567
567
@mock .patch ('utilities_common.platform_sfputil_helper.logical_port_name_to_physical_port_list' , mock .MagicMock (return_value = [0 ]))
568
568
@mock .patch ('sonic_y_cable.y_cable.check_read_side' , mock .MagicMock (return_value = (1 )))
569
569
@mock .patch ('sonic_y_cable.y_cable.check_mux_direction' , mock .MagicMock (return_value = (1 )))
570
+ @mock .patch ('re.match' , mock .MagicMock (return_value = (True )))
570
571
def test_show_muxcable_hwmode_muxdirection_port_active (self ):
571
572
runner = CliRunner ()
572
573
db = Db ()
@@ -583,6 +584,7 @@ def test_show_muxcable_hwmode_muxdirection_port_active(self):
583
584
@mock .patch ('utilities_common.platform_sfputil_helper.logical_port_name_to_physical_port_list' , mock .MagicMock (return_value = [0 ]))
584
585
@mock .patch ('sonic_y_cable.y_cable.check_read_side' , mock .MagicMock (return_value = (1 )))
585
586
@mock .patch ('sonic_y_cable.y_cable.check_mux_direction' , mock .MagicMock (return_value = (1 )))
587
+ @mock .patch ('re.match' , mock .MagicMock (return_value = (True )))
586
588
def test_show_muxcable_hwmode_muxdirection_active (self ):
587
589
runner = CliRunner ()
588
590
db = Db ()
@@ -597,6 +599,7 @@ def test_show_muxcable_hwmode_muxdirection_active(self):
597
599
@mock .patch ('utilities_common.platform_sfputil_helper.logical_port_name_to_physical_port_list' , mock .MagicMock (return_value = [0 ]))
598
600
@mock .patch ('sonic_y_cable.y_cable.check_read_side' , mock .MagicMock (return_value = (1 )))
599
601
@mock .patch ('sonic_y_cable.y_cable.check_mux_direction' , mock .MagicMock (return_value = (2 )))
602
+ @mock .patch ('re.match' , mock .MagicMock (return_value = (True )))
600
603
def test_show_muxcable_hwmode_muxdirection_port_standby (self ):
601
604
runner = CliRunner ()
602
605
db = Db ()
@@ -613,6 +616,7 @@ def test_show_muxcable_hwmode_muxdirection_port_standby(self):
613
616
@mock .patch ('utilities_common.platform_sfputil_helper.logical_port_name_to_physical_port_list' , mock .MagicMock (return_value = [0 ]))
614
617
@mock .patch ('sonic_y_cable.y_cable.check_read_side' , mock .MagicMock (return_value = (1 )))
615
618
@mock .patch ('sonic_y_cable.y_cable.check_mux_direction' , mock .MagicMock (return_value = (2 )))
619
+ @mock .patch ('re.match' , mock .MagicMock (return_value = (True )))
616
620
def test_show_muxcable_hwmode_muxdirection_standby (self ):
617
621
runner = CliRunner ()
618
622
db = Db ()
0 commit comments