Exemple #1
0
 def test_getPeripheralsbyRoom(self):
     ruuid = pL.insertRoom("PTest Room", "4", "Test")
     p1uuid = pL.insertPeripheral(ruuid, "Test", "Light", "True", "True",
                                  1.0, None)
     p2uuid = pL.insertPeripheral(ruuid, "Test", "Camera", "True", "True",
                                  1.0, None)
     peris = pL.getPeripheralsbyRoom(ruuid)
     presence = 0
     for peri in peris:
         presence = presence + 1
     self.assertTrue(presence == 2)
Exemple #2
0
 def test_getPeripherals(self):
     r1uuid = pL.insertRoom("PTest Room", "6", "PTest")
     r2uuid = pL.insertRoom("PTest Room", "7", "PTest")
     p1uuid = pL.insertPeripheral(r1uuid, "Test", "Light", "True", "True",
                                  1.0, None)
     p2uuid = pL.insertPeripheral(r2uuid, "Test", "Camera", "True", "True",
                                  1.0, None)
     AllPeris = pL.getPeripherals()
     presence = 0
     for Peri in AllPeris:
         if Peri['uuid'] == p1uuid or Peri['uuid'] == p2uuid:
             presence = presence + 1
     self.assertTrue(presence == 2)
Exemple #3
0
 def test_updatePeripheralActive(self):
     ruuid = pL.insertRoom("PTest Room", "9", "PTest")
     puuid = pL.insertPeripheral(ruuid, "Test", "Light", "True", "True",
                                 1.0, None)
     pL.updatePeripheralActive("False", puuid)
     self.assertFalse(pL.getPeripheralbyUUID(puuid)['active'])
     pL.updatePeripheralActive("True", puuid)
     self.assertTrue(pL.getPeripheralbyUUID(puuid)['active'])
Exemple #4
0
 def test_getPeripheralsbyType(self):
     ruuid = pL.insertRoom("PTest Room", "8", "PTest")
     p1uuid = pL.insertPeripheral(ruuid, "Test", "Light", "True", "True",
                                  1.0, None)
     p2uuid = pL.insertPeripheral(ruuid, "Test", "Camera", "True", "True",
                                  1.0, None)
     Lights = pL.getPeripheralsbyType("Light")
     p1present = False
     p2present = False
     for Light in Lights:
         if Light['uuid'] == p1uuid:
             p1present = True
         if Light['uuid'] == p2uuid:
             p2present = True
     self.assertTrue(p1present and not p2present)
     Cameras = pL.getPeripheralsbyType("Camera")
     p1present = False
     p2present = False
     for Camera in Cameras:
         if Camera['uuid'] == p1uuid:
             p1present = True
         if Camera['uuid'] == p2uuid:
             p2present = True
     self.assertTrue(not p1present and p2present)
Exemple #5
0
 def test_getStatusbyUUID(self):
     ruuid = pL.insertRoom("PTest Room", "5", "PTest")
     puuid = pL.insertPeripheral(ruuid, "Test", "Light", "True", "True",
                                 1.0, None)
     self.assertTrue(pL.getStatusbyUUID(puuid))
Exemple #6
0
 def test_deletePeripheral(self):
     ruuid = pL.insertRoom("PTest Room", "2", "PTest")
     puuid = pL.insertPeripheral(ruuid, "Test", "Light", "True", "True",
                                 1.0, None)
     pL.deletePeripheral(puuid)
     self.assertTrue(pL.getPeripheralbyUUID(puuid) == None)
Exemple #7
0
 def test_insertPeripheral(self):
     ruuid = pL.insertRoom("PTest Room", "1", "PTest")
     puuid = pL.insertPeripheral(ruuid, "Test", "Light", "True", "True",
                                 1.0, None)
     self.assertTrue(puuid != None)