Esempio n. 1
0
 def test_getSessions(
     self
 ):  # add two users, attempt to get all Sessions, confirm their presence
     userA_uuid = pL.insertUser("*****@*****.**")
     userB_uuid = pL.insertUser("*****@*****.**")
     sessAUUID = pL.insertSession(userA_uuid, "TOKENABCDEF", "0.0.0.123")
     sessBUUID = pL.insertSession(userB_uuid, "TOKENABCDEF", "0.0.0.123")
     sessions = pL.getSessions()
     presence = 0
     for session in sessions:
         if session['uuid'] == sessAUUID or session['uuid'] == sessBUUID:
             presence = presence + 1
     self.assertTrue(presence == 2)
Esempio n. 2
0
 def test_updateSessionvalue(
     self
 ):  # insert Session, change value to False verify, then to True verify
     user_uuid = pL.insertUser("*****@*****.**")
     sessUUID = pL.insertSession(user_uuid, "TOKENABCDEF", "0.0.0.123")
     pL.updateSessionValue(False, sessUUID)
     self.assertFalse(pL.getSessionbyUUID(sessUUID)['invalidated'])
     pL.updateSessionValue(True, sessUUID)
     self.assertTrue(pL.getSessionbyUUID(sessUUID)['invalidated'])
Esempio n. 3
0
 def test_TimeRangebyUUID(
     self
 ):  # get time range from session, verify times exist, verify expires > created
     user_uuid = pL.insertUser("*****@*****.**")
     sessUUID = pL.insertSession(user_uuid, "TOKENABCDEF", "0.0.0.123")
     created, expired = pL.getTimeRangebyUUID(sessUUID)
     self.assertTrue(created != 0)
     self.assertTrue(expired != 0)
     self.assertTrue(expired > created)
Esempio n. 4
0
 def test_getSessionbyUUID(self):  # attempt to get a Session by UUID
     user_uuid = pL.insertUser("*****@*****.**")
     sessUUID = pL.insertSession(user_uuid, "TOKENABCDEF", "0.0.0.123")
     self.assertTrue(pL.getSessionbyUUID(sessUUID) != None)
Esempio n. 5
0
 def test_deleteSession(self):  # attempt to delete a Session
     user_uuid = pL.insertUser("*****@*****.**")
     sessUUID = pL.insertSession(user_uuid, "TOKENABCDEF", "0.0.0.123")
     pL.deleteSession(sessUUID)
     self.assertTrue(pL.getSessionbyUUID(sessUUID) == None)
Esempio n. 6
0
 def test_insertSession(self):  # attempt to insert a Session
     user_uuid = pL.insertUser("*****@*****.**")
     sessUUID = pL.insertSession(user_uuid, "TOKENABCDEF", "0.0.0.123")
     self.assertTrue(sessUUID != None)