def test_get_data_float_param(self): config = UtilsTester.config['numberParams'] driver = BaseDriver(config, None) driver.sendCommandRaw = MagicMock(return_value='1.2') response = driver.getData('floatResult') self.assertEqual(response['result'], 1.2)
def test_get_data_translate(self): config = UtilsTester.config['driver'] driver = BaseDriver(config, None) driver.sendCommandRaw = MagicMock(return_value='value1') response = driver.getData('command4') self.assertEqual(response['output'], 'value1') self.assertEqual(response['result'], 'key1') driver.sendCommandRaw.assert_called_with( 'command4', config['commands']['command4'])
def test_simple(self): config = UtilsTester.config['driver'] driver = BaseDriver(config, None) self.assertEqual(len(driver.getData('commands')['commands']), 6)