class CorsairHidPsuTestCase(unittest.TestCase): def setUp(self): self.mock_hid = _MockPsuDevice() self.device = CorsairHidPsu(self.mock_hid, 'Mock Corsair HID PSU') self.device.connect() def tearDown(self): self.device.disconnect() def test_not_totally_broken(self): """A few reasonable example calls do not raise exceptions.""" self.device.initialize() status = self.device.get_status() self.device.set_fixed_speed(channel='fan', duty=50)
def mock_psu(): pid, vid, _, desc, kwargs = CorsairHidPsu.SUPPORTED_DEVICES[0] device = MockPsu(vendor_id=vid, product_id=pid, address='addr') return CorsairHidPsu(device, f'Mock {desc}', **kwargs)
def setUp(self): self.mock_hid = _MockPsuDevice() self.device = CorsairHidPsu(self.mock_hid, 'Mock Corsair HID PSU') self.device.connect()
def mockPsuDevice(): device = _MockPsuDevice(vendor_id=0x1b1c, product_id=0x1c05, address='addr') return CorsairHidPsu(device, 'mock Corsair HX750i PSU')