class Test(unittest.TestCase): def setUp(self): self.protocol = RFXtrxProtocol(None, None) self.protocol._handle_lighting2_response(response[2:]) self.protocol._handle_lighting2_response(response2[2:]) def testSubtype(self): ''' Test whether the correct subtype is parsed. ''' self.assertEqual(self.protocol._devices[0].subtype, 'HomeEasy EU', 'Unexpected subtype') self.assertEqual(self.protocol._devices[1].subtype, 'AC', 'Unexpected subtype') def testUnit(self): ''' Test whether the correct unit code is parsed. ''' self.assertEqual(self.protocol._devices[0].unit, 11, 'Unexpected unit') self.assertEqual(self.protocol._devices[1].unit, 12, 'Unexpected unit') def testCommand(self): ''' Test whether the correct command is parsed. ''' self.assertEqual(self.protocol._devices[0].command, 'On', 'Unexpected command') self.assertEqual(self.protocol._devices[1].command, 'On', 'Unexpected command') def testId(self): ''' Test whether the correct id is parsed. ''' self.assertEqual(self.protocol._devices[0].id, '00815E2', 'Unexpected ID') self.assertEqual(self.protocol._devices[1].id, '016AE2A', 'Unexpected ID')
class Test(unittest.TestCase): def setUp(self): self.protocol = RFXtrxProtocol(None, None) self.protocol._handle_temp_hum_baro(response[2:]) def testSubtype(self): """ Test whether the correct subtype is parsed. """ self.assertEqual(self.protocol._devices[0].subtype, "BTHR918N, BTHR968", "Invalid subtype") def testTemperature(self): """ Test whether the correct temperature is parsed. """ self.assertEqual(self.protocol._devices[0].temperature, "20.8", "Invalid temperature") def testHumidity(self): """ Test whether the correct humidity is parsed. """ self.assertEqual(self.protocol._devices[0].humidity, 32, "Invalid humidity") def testBarometer(self): """ Test whether the correct barometer value is parsed. """ self.assertEqual(self.protocol._devices[0].barometer, 1012, "Invalid barometer") def testForecast(self): """ Test whether the correct forecast value is parsed. """ self.assertEqual(self.protocol._devices[0].forecast, "Sunny", "Invalid forecast") def testBattery(self): """ Test whether the correct battery value is parsed. """ self.assertEqual(self.protocol._devices[0].battery, "Low", "Invalid battery") def testRSSI(self): """ Test whether the correct RSSI value is parsed. """ self.assertEqual(self.protocol._devices[0].rssi, 6, "Invalid RSSI")
class Test(unittest.TestCase): def setUp(self): self.protocol = RFXtrxProtocol(None, None) self.protocol._handle_wind_response(response[2:]) def testID(self): ''' Test whether the correct ID is parsed. ''' self.assertEqual(self.protocol._devices[0].id, 12032, 'Unexpected ID') def testSubtype(self): ''' Test whether the correct subtype is parsed. ''' self.assertEqual(self.protocol._devices[0].subtype, 'WTGR800', 'Unexpected subtype') def testDirection(self): ''' Test whether the correct direction is parsed. ''' self.assertEqual(self.protocol._devices[0].direction, 247 , 'Unexpected direction') def testAverageSpeed(self): ''' Test whether the correct average speed is parsed. ''' self.assertEqual(self.protocol._devices[0].average_speed, 3.2 , 'Unexpected average speed') def testWindGust(self): ''' Test whether the correct wind gust is parsed. ''' self.assertEqual(self.protocol._devices[0].gust, 3.6 , 'Unexpected wind gust') def testBattery(self): ''' Test whether the correct battery level is parsed. ''' self.assertEqual(self.protocol._devices[0].battery, 'OK' , 'Unexpected battery level')
class Test(unittest.TestCase): def setUp(self): self.protocol = RFXtrxProtocol(None, None) self.protocol._handle_security1_response(response[2:]) def testStatus(self): ''' Test whether the correct status string is parsed. ''' self.assertEqual(self.protocol._devices[0].status, 'Normal', 'Unexpected status') def testSubtype(self): ''' Test whether the correct subtype is parsed. ''' self.assertEqual(self.protocol._devices[0].subtype, 'X10 security door/window sensor', 'Unexpected subtype') def testBatteryLevel(self): ''' Test whether the correct battery level is parsed. ''' self.assertEqual(self.protocol._devices[0].battery_level, 'OK', 'Unexpected battery level')
def setUp(self): self.protocol = RFXtrxProtocol(None, None) self.protocol._handle_lighting2_response(response[2:]) self.protocol._handle_lighting2_response(response2[2:])
def setUp(self): self.protocol = RFXtrxProtocol(None, None) self.protocol._handle_temp_hum_baro(response[2:])
def setUp(self): self.protocol = RFXtrxProtocol(None, None) self.protocol._handle_security1_response(response[2:])