def test_auto_update_firmware_cpld(monkeypatch, update_func, image_found,
                                   boot_type, expect):
    def mock_path_exists(path):
        return image_found

    test_component = ComponentCPLD(0)

    monkeypatch.setattr(test_component, 'install_firmware', update_func)
    monkeypatch.setattr(os.path, 'exists', mock_path_exists)

    result = test_component.auto_update_firmware(None, boot_type)

    assert result == expect
Example #2
0
 def initialize_components(self):
     # Initialize component list
     from sonic_platform.component import ComponentONIE, ComponentSSD, ComponentBIOS, ComponentCPLD
     self._component_list.append(ComponentONIE())
     self._component_list.append(ComponentSSD())
     self._component_list.append(ComponentBIOS())
     self._component_list.extend(ComponentCPLD.get_component_list())
 def initialize_components(self):
     # Initialize component list
     from sonic_platform.component import ComponentBIOS, ComponentCPLD
     self._component_list.append(ComponentBIOS())
     self._component_list.append(ComponentCPLD())