Skip to content

Commit d30d02a

Browse files
committed
fix unit test
Signed-off-by: Lin Jin <[email protected]>
1 parent 101d8fe commit d30d02a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sonic-psud/tests/test_psud.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def test_wrapper_get_num_psus():
5757
# Test with None logger - should not crash
5858
psud.platform_chassis = mock.MagicMock()
5959
psud.platform_psuutil = mock.MagicMock()
60+
psud._wrapper_get_num_psus(None)
6061
assert psud.platform_chassis.get_num_psus.call_count >= 1
6162

6263
# Test when both providers are unavailable
@@ -310,6 +311,7 @@ def test_wrapper_get_psu_status():
310311

311312
# Test new platform API not available
312313
psud.platform_chassis = None
314+
psud._wrapper_get_psu_status(mock_logger, 1)
313315
# Should use platform_psuutil
314316
assert psud.platform_psuutil.get_psu_status.call_count == 1
315317
psud.platform_psuutil.get_psu_status.assert_called_with(1)
@@ -412,7 +414,7 @@ def test_get_psu_key():
412414
# Test PSU available but get_name() raises general Exception
413415
mock_psu.get_name.side_effect = RuntimeError("Hardware error")
414416
result = psud.get_psu_key(4)
415-
assert result is False
417+
assert result == "PSU 4"
416418
psud.platform_chassis.get_psu.assert_called_with(3) # psu_index - 1
417419
mock_psu.get_name.assert_called_once()
418420

0 commit comments

Comments
 (0)