Skip to content

Commit

Permalink
Added new unit test - test_load_media_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
tshalvi committed Nov 26, 2023
1 parent b5c8c0a commit 6d0142b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sonic-xcvrd/tests/test_xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,15 @@ def test_init_port_sfp_status_tbl(self):
task = SfpStateUpdateTask(DEFAULT_NAMESPACE, port_mapping, stop_event, sfp_error_event)
task._init_port_sfp_status_tbl(port_mapping, xcvr_table_helper, stop_event)

@patch('sonic_py_common.device_info.get_paths_to_platform_and_hwsku_dirs', MagicMock())
def test_load_media_settings(self, mock_platform_dir_path):
mock_platform_dir_path.return_value = ('/invalid/path', None)
assert media_settings_parser.load_media_settings() == {}

mock_platform_dir_path.return_value = (test_path, None)
media_settings_parser.load_media_settings()
assert media_settings_parser.g_dict == media_settings_dict

@patch('xcvrd.xcvrd.platform_chassis')
@patch('xcvrd.xcvrd.is_cmis_api')
def test_get_media_settings_key(self, mock_is_cmis_api, mock_chassis):
Expand Down

0 comments on commit 6d0142b

Please sign in to comment.