def test_updateBLOB_1(): class Test: name = 'test' propertyName = '' deviceName = '' app.imaging.device = None app.imaging.device = IndiClass().device suc = app.imaging.updateBLOB(propertyName=propertyName, deviceName=deviceName) assert not suc
def test_updateLight_1(): class Test: name = 'test' propertyName = '' deviceName = '' app.camera.device = None app.camera.device = IndiClass().device suc = app.camera.updateLight(propertyName=propertyName, deviceName=deviceName) assert not suc
def test_AddDevicesWithType_1(qtbot): app = DevicePopup(geometry=geometry, data=data, framework=framework, driver='telescope', deviceType='telescope') qtbot.addWidget(app) device = Device() app.indiClass = IndiClass() with mock.patch.object(device, 'getText', return_value={'DRIVER_INTERFACE': None}): suc = app.addDevicesWithType('telescope', 'test') assert not suc
def searchDevices(self): """ searchDevices implements a search for devices of a certain device type. it is called from a button press and checks which button it was. after that for the right device it collects all necessary data for host value, instantiates an INDI client and watches for all devices connected to this server. Than it connects a subroutine for collecting the right device names and opens a model dialog. the data collection takes place as long as the model dialog is open. when the user closes this dialog, the collected data is written to the drop down list. :return: true for test purpose """ self.indiDeviceList = list() for device in self.indiDevices: # simplify devObj = self.indiDevices[device] if devObj['uiSearch'] != self.sender(): continue host = ( devObj['host'].text(), int(devObj['port'].text()), ) self.indiClass = IndiClass(host=host) self.indiSearchType = devObj['searchType'] self.indiClass.client.signals.defText.connect( self.addDevicesWithType) self.indiClass.client.connectServer() self.indiClass.client.watchDevice() msg = PyQt5.QtWidgets.QMessageBox msg.critical(self, 'Searching Devices', f'Search for {device} could take some seconds!') self.indiClass.client.disconnectServer() self.indiClass = None self.indiSearchType = None devObj['uiName'].clear() devObj['uiName'].setView(PyQt5.QtWidgets.QListView()) devObj['uiName'].addItem('No device driver selected') for deviceName in self.indiDeviceList: devObj['uiName'].addItem(deviceName) return True
def test_AddDevicesWithType_4(qtbot): app = DevicePopup(geometry=geometry, data=data, framework=framework, driver='telescope', deviceType='telescope') qtbot.addWidget(app) device = Device() app.indiClass = IndiClass() app.indiClass.client.devices['telescope'] = device app.indiSearchType = 1 app.indiSearchNameList = list() with mock.patch.object(device, 'getText', return_value={'DRIVER_INTERFACE': 1}): suc = app.addDevicesWithType('telescope', 'test') assert suc
def searchDevices(self): """ searchDevices implements a search for devices of a certain device type. it is called from a button press and checks which button it was. after that for the right device it collects all necessary data for host value, instantiates an INDI client and watches for all devices connected to this server. Than it connects a subroutine for collecting the right device names and opens a model dialog. the data collection takes place as long as the model dialog is open. when the user closes this dialog, the collected data is written to the drop down list. :return: success finding """ self.indiSearchNameList = list() if self.driver in self.indiDefaults: self.indiSearchNameList.append(self.indiDefaults[self.driver]) else: host = (self.ui.indiHost.text(), int(self.ui.indiPort.text())) self.indiClass = IndiClass() self.indiClass.host = host self.indiClass.client.signals.defText.connect( self.addDevicesWithType) self.indiClass.client.connectServer() self.indiClass.client.watchDevice() msg = PyQt5.QtWidgets.QMessageBox msg.information( self, 'Searching Devices', f'Search for [{self.driver}] could take some seconds!') self.indiClass.client.disconnectServer() self.ui.indiNameList.clear() self.ui.indiNameList.setView(PyQt5.QtWidgets.QListView()) for name in self.indiSearchNameList: self.log.info(f'Indi search found: {name}') for deviceName in self.indiSearchNameList: self.ui.indiNameList.addItem(deviceName) return True
def test_setUpdateConfig_3(): deviceName = 'CCD Simulator' app.imaging.device = IndiClass().device app.imaging.name = 'CCD Simulator' suc = app.imaging.setUpdateConfig(deviceName=deviceName) assert not suc