Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@mock.patch.object(sarge.Pipeline, 'wait_events')
@mock.patch('sarge.run')
@mock.patch('octoprint_firmwareupdater.os.path.dirname')
def test_flash_worker_ok(self, mock_dirname, mock_sarge_run, mock_wait_events, mock_send_status):
# Set Up
self.plugin = octoprint_firmwareupdater.FirmwareupdaterPlugin()
self.plugin._settings = settings_mock()
self.plugin._logger = logger_mock()
self.plugin._printer = printer_mock()
p = pipeline_mock()
mock_sarge_run.return_value = p
hex_file = named_temporary_file_mock()
hex_file.close = mock.MagicMock(name='close')
# Call test subject
self.plugin._flash_worker(hex_file, "port")