Example #1
0
 def remove(self, cid, stype):
     sensor_class = TYPES[stype]
     uid = get_uid(sensor_class, cid)
     try:
         self.sensors[uid].kill()
         del self.sensors[uid]
     except KeyError:
         raise NoSensorFound(cid, stype)
Example #2
0
 def remove(self, cid, stype):
     sensor_class = TYPES[stype]
     uid = get_uid(sensor_class, cid)
     try:
         self.sensors[uid].kill()
         del self.sensors[uid]
     except KeyError:
         raise NoSensorFound(cid, stype)
Example #3
0
    def test_add_dummy_sensor(self):
        data = {
            'cid': 'fake-container',
        }
        resp = self.daemon.post('/sensors/dummy', data=data)
        self.assertEquals(resp.status_code, 201)

        resp_data = json.loads(resp.data)['sensor']
        self.assertTrue('cid' in resp_data.keys())
        self.assertTrue('uid' in resp_data.keys())
        self.assertTrue('spacing' in resp_data.keys())
        uid = get_uid(TYPES['dummy'], resp_data['cid'])
        self.assertEquals(uid, resp_data['uid'])