def test_firmware_update_should_create_and_run_firmware_update(self, mock_sys, mock_glob, mock_firmware_manager_factory, mock_FirmwareUpdate): mock_firmware_update = mock_FirmwareUpdate.return_value self._setup_mock(mock_sys, mock_firmware_manager_factory, mock_glob) expected_call_back = "Boop" fwapi = FirmwareAPI() fwapi.update_firmware(expected_call_back) mock_FirmwareUpdate.assert_called_with(self.expected_firmware_file, self.mock_firmware_updater) mock_firmware_update.start.assert_called_with(expected_call_back)
def test_firmware_update_should_raise_exception_if_not_ready(self, mock_sys, mock_glob, mock_firmware_manager_factory, mock_FirmwareUpdate): self._setup_mock(mock_sys, mock_firmware_manager_factory, mock_glob) self.mock_firmware_updater.check_ready.return_value = False fwapi = FirmwareAPI() with self.assertRaises(Exception) as context: fwapi.update_firmware() self.assertEquals("Peachy Printer not ready for update", context.exception.message)
def test_firmware_update_should_create_and_run_firmware_update( self, mock_sys, mock_glob, mock_firmware_manager_factory, mock_FirmwareUpdate): mock_firmware_update = mock_FirmwareUpdate.return_value self._setup_mock(mock_sys, mock_firmware_manager_factory, mock_glob) expected_call_back = "Boop" fwapi = FirmwareAPI() fwapi.update_firmware(expected_call_back) mock_FirmwareUpdate.assert_called_with(self.expected_firmware_file, self.mock_firmware_updater) mock_firmware_update.start.assert_called_with(expected_call_back)
def test_firmware_update_should_raise_exception_if_not_ready( self, mock_sys, mock_glob, mock_firmware_manager_factory, mock_FirmwareUpdate): self._setup_mock(mock_sys, mock_firmware_manager_factory, mock_glob) self.mock_firmware_updater.check_ready.return_value = False fwapi = FirmwareAPI() with self.assertRaises(Exception) as context: fwapi.update_firmware() self.assertEquals("Peachy Printer not ready for update", context.exception.message)