Ejemplo n.º 1
0
 def test_add_probe(self):
     probe = Probe("666AAA", "Dummy10")
     db_adapter.store_probe(probe)
     all_probes = db_adapter.get_all_probes()
     assert(len(all_probes) == 4)
     assert(all_probes[3].probe_id == '666AAA')
     assert(all_probes[3].name == 'Dummy10')
 def test_set_master_probe(self):
     temperature_probes.determine_master_probe()
     all_probes = db_adapter.get_all_probes()
     assert all_probes[0].master
     assert not all_probes[1].master
     assert not all_probes[2].master
     temperature_probes.master_probe_id = all_probes[0].probe_id
     # change the master probe
     temperature_probes.set_probe_as_master(all_probes[2].probe_id)
     all_probes = db_adapter.get_all_probes()
     assert not all_probes[0].master
     assert not all_probes[1].master
     assert all_probes[2].master
     temperature_probes.master_probe_id = all_probes[2].probe_id
     # set no probe to master
     temperature_probes.set_probe_as_not_master(all_probes[2].probe_id)
     all_probes = db_adapter.get_all_probes()
     assert not all_probes[0].master
     assert not all_probes[1].master
     assert not all_probes[2].master
 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"
Ejemplo n.º 4
0
def get_all_probes():
    response.content_type = 'application/json;' 
    return json_parser.get_probe_array_as_json(db_adapter.get_all_probes())