Exemplo n.º 1
0
 def test_getRooms(
     self
 ):  # add two rooms, attempt to get all rooms, confim presence of both
     ruuid1 = pL.insertRoom("Test Room #3", "3", "Test")
     ruuid2 = pL.insertRoom("Test Room #4", "4", "Test")
     rooms = pL.getRooms()
     presence = 0
     for room in rooms:
         if room['uuid'] == ruuid1 or room['uuid'] == ruuid2:
             presence = presence + 1
     self.assertTrue(presence == 2)
Exemplo n.º 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)
Exemplo n.º 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'])
Exemplo n.º 4
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)
Exemplo n.º 5
0
 def setUp(self):
     Ts = pL.getTransactions()
     for T in Ts:
         pL.deleteTransaction(T['uuid'])
     Users = pL.getUsers()
     for user in Users:
         if str.startswith(user['email'], "TestingEmail"):
             pL.deleteUser(user['uuid'])
     Rooms = pL.getRooms()
     for room in Rooms:
         if str.startswith(room['floor'], "Test"):
             pL.deleteRoom(room['uuid'])
     self._user = pL.insertUser("*****@*****.**")
     self._room = pL.insertRoom("Test Room", "12", "Test")
Exemplo n.º 6
0
 def setUp(self):
     RSR = pL.getMaintenanceRequests()
     for rsr in RSR:
         pL.deleteMaintenanceRequest(rsr['uuid'])
     Users = pL.getUsers()
     for user in Users:
         if str.startswith(user['email'], "TestingEmail"):
             pL.deleteUser(user['uuid'])
     Rooms = pL.getRooms()
     for room in Rooms:
         if str.startswith(room['floor'], "Test"):
             pL.deleteRoom(room['uuid'])
     self._user = pL.insertUser("*****@*****.**")
     self._room = pL.insertRoom("Test Room", "12", "Test")
Exemplo n.º 7
0
 def setUp(self):
     Rs = pL.getReservations()
     for R in Rs:
         pL.deleteReservation(R['uuid'])
     Guests = pL.getGuests()
     for guest in Guests:
         if str.startswith(guest['last_name'], "TestReservation"):
             pL.deleteGuest(guest['uuid'])
     Rooms = pL.getRooms()
     for room in Rooms:
         if str.startswith(room['floor'], "Test"):
             pL.deleteRoom(room['uuid'])
     self._guest = pL.insertGuest("Sam", "A.", "TestReservation",
                                  "*****@*****.**", "555-1234",
                                  "12 Test Lane", "Testville", "Tenesse",
                                  "00022")
     self._room = pL.insertRoom("Test Room", "12", "Test")
Exemplo n.º 8
0
 def setUp(self):
     RSR = pL.getRoomServiceRequests()
     for rsr in RSR:
         pL.deleteRoomServiceRequest(rsr['uuid'])
     Users = pL.getUsers()
     for user in Users:
         if str.startswith(user['email'], "TestingEmail"):
             pL.deleteUser(user['uuid'])
     Rooms = pL.getRooms()
     for room in Rooms:
         if str.startswith(room['floor'], "Test"):
             pL.deleteRoom(room['uuid'])
     TPs = pL.getRoomServiceItems()
     for TP in TPs:
         if str.startswith(TP['name'], "Test"):
             pL.deleteRoomServiceItem(TP['uuid'])
     self._user = pL.insertUser("*****@*****.**")
     self._room = pL.insertRoom("Test Room", "12", "Test")
     self._type = pL.insertRoomServiceItem("Test Room Service Item 6",
                                           "Description", "3.50", None,
                                           "0000123")
Exemplo n.º 9
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)
Exemplo n.º 10
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))
Exemplo n.º 11
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)
Exemplo n.º 12
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)
Exemplo n.º 13
0
 def test_getRoombyUUID(self):  # add a room, find it using its uuid
     ruuid = pL.insertRoom("Test Room #5", "5", "Test")
     self.assertTrue(pL.getRoombyUUID(ruuid) != None)
Exemplo n.º 14
0
 def test_deleteRoom(self):  # attempt to deleta a room
     ruuid = pL.insertRoom("Test Room #2", "2", "Test")
     pL.deleteRoom(ruuid)
     self.assertTrue(pL.getRoombyUUID(ruuid) == None)
Exemplo n.º 15
0
 def test_insertRoom(self):  # attempt to insert a room
     ruuid = pL.insertRoom("Test Room #1", "1", "Test")
     self.assertTrue(ruuid != None)