Ejemplo n.º 1
0
def set_probe(probe_id):
    probe = db_adapter.get_probe_by_id(probe_id)
    if probe is None:
        abort(400, 'Probe with id "' + probe_id + '" does not exist.')
    else:
        new_name = _get_parameter_value('name')
        master = _get_boolean_value("master")
        if new_name is not None:
            temperature_probes.set_probe_name(probe_id, new_name)
            print 'Set name of probe ' + probe_id + ' to ' + new_name        
        if master is not None:
            if master: 
                temperature_probes.set_probe_as_master(probe_id)
                print 'Probe ' + probe_id + ' is now the master probe.'
            else: 
                temperature_probes.set_probe_as_not_master(probe_id)
                print 'Probe ' + probe_id + ' is no longer the master probe.'                
    response.status = 204
 def test_change_probe_name(self):
     temperature_probes.set_probe_name(db_adapter.get_all_probes()[1].probe_id, "new name")
     assert db_adapter.get_all_probes()[1].name == "new name"