Exemple #1
0
 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']
                 }
             }
         })
Exemple #2
0
 def test_getVersionEmpty(self):
     tupleDB = ()
     db = MockDatabase(tupleDB)
     h = House(db)
     self.assertEqual(h.getVersion(), {'supportedTypes': {}})
Exemple #3
0
 def test_getVersionEmpty(self):
     tupleDB = ()
     db = MockDatabase(tupleDB)
     h = House(db)
     self.assertEqual(h.getVersion(), {'supportedTypes' : {}})
Exemple #4
0
 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']}}})