def test_getVersion(self): tupleDB = (('motionSensor', 'getState'), ('light', 'on'), ('light', 'off'), ('light', 'getState')) db = MockDatabase(tupleDB) h = House(db) self.assertEqual( h.getVersion(), { 'supportedTypes': { 'motionSensor': { 'states': [{ 'id': 1, 'name': 'motion detected' }, { 'id': 0, 'name': 'no motion' }], 'supportedBrands': ['mock', 'arduino'], 'name': 'Motion Sensor', 'isPassive': True, 'methods': ['getState'] }, 'light': { 'states': [{ 'method': 'on', 'id': 1, 'name': 'on' }, { 'method': 'off', 'id': 0, 'name': 'off' }], 'supportedBrands': ['mock', 'lightwaveRF'], 'name': 'Light', 'isPassive': False, 'methods': ['on', 'off', 'getState'] } } })
def test_getVersionEmpty(self): tupleDB = () db = MockDatabase(tupleDB) h = House(db) self.assertEqual(h.getVersion(), {'supportedTypes': {}})
def test_getVersionEmpty(self): tupleDB = () db = MockDatabase(tupleDB) h = House(db) self.assertEqual(h.getVersion(), {'supportedTypes' : {}})
def test_getVersion(self): tupleDB = (('motionSensor', 'getState'), ('light', 'on'), ('light', 'off'), ('light', 'getState')) db = MockDatabase(tupleDB) h = House(db) self.assertEqual(h.getVersion(), {'supportedTypes': {'motionSensor': {'states': [{'id': 1, 'name': 'motion detected'}, {'id': 0, 'name': 'no motion'}], 'supportedBrands': ['mock', 'arduino'], 'name': 'Motion Sensor', 'isPassive': True, 'methods': ['getState']}, 'light': {'states': [{'method': 'on', 'id': 1, 'name': 'on'}, {'method': 'off', 'id': 0, 'name': 'off'}], 'supportedBrands': ['mock', 'lightwaveRF'], 'name': 'Light', 'isPassive': False, 'methods': ['on', 'off', 'getState']}}})