Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
chiourung authored and prgeor committed Apr 21, 2024
1 parent 4fd47f5 commit 37bc6bc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sonic-xcvrd/tests/test_xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2475,6 +2475,20 @@ def test_wrapper_get_sfp_error_description(self, mock_chassis):
mock_chassis.get_sfp = MagicMock(side_effect=NotImplementedError)
assert not _wrapper_get_sfp_error_description(1)

@patch('xcvrd.xcvrd.platform_chassis')
def test_wrapper_is_flat_memory(self, mock_chassis):
mock_api = MagicMock()
mock_api.is_flat_memory = MagicMock(return_value=True)
mock_object = MagicMock()
mock_object.get_xcvr_api = MagicMock(return_value=mock_api)
mock_chassis.get_sfp = MagicMock(return_value=mock_object)

from xcvrd.xcvrd import _wrapper_is_flat_memory
assert _wrapper_is_flat_memory(1) == True

mock_chassis.get_sfp = MagicMock(side_effect=NotImplementedError)
assert not _wrapper_is_flat_memory(1)

def test_check_port_in_range(self):
range_str = '1 - 32'
physical_port = 1
Expand Down

0 comments on commit 37bc6bc

Please sign in to comment.