def test_read_key_file_no_fichero(self):
     my_key = AccessManager()
     my_key.pathJson = str(Path.cwd()) + "/../../"
     with self.assertRaises(AccessManagementException) as AME:
         my_key.open_door(
             "821c9d9cf4ab2255fd53a8365042a12f49f183e82b811f8ae2dc3ebe941b3bb4"
         )
     self.assertEqual(AME.exception.message, "Archivo incorrecto")
 def test_open_door_no_clave(self):
     my_key = AccessManager()
     with self.assertRaises(AccessManagementException) as AME:
         my_key.open_door(
             "1111111111111111111111111111111111111111111111111111111111111111"
         )
     self.assertEqual(AME.exception.message,
                      "Clave no encontrada o ha expirado")
 def test_open_door_clave_fecha_exp(self):
     my_key = AccessManager()
     with self.assertRaises(AccessManagementException) as AME:
         result = my_key.open_door(
             "1d637b7964889b2dd952e9858805dd6a4e0a02d60a3ebdb9dcf7b3c494743625"
         )
     self.assertEqual(AME.exception.message,
                      "Clave no encontrada o ha expirado")
 def test_open_door_clave_fecha_0(self):
     my_key = AccessManager()
     with self.assertRaises(AccessManagementException) as AME:
         result = my_key.open_door(
             "4612e8c1d700d1268481a80600bb19d1529e158de6a7e77e00afd77297337596"
         )
     self.assertEqual(AME.exception.message,
                      "Clave no encontrada o ha expirado")
 def test_read_key_file_fichero_mal(self):
     my_key = AccessManager()
     my_key.pathJson = str(Path.cwd()) + "/../../Almacen_solicitudes/"
     with self.assertRaises(AccessManagementException) as AME:
         my_key.open_door(
             "821c9d9cf4ab2255fd53a8365042a12f49f183e82b811f8ae2dc3ebe941b3bb4"
         )
     self.assertEqual(AME.exception.message,
                      "JSON Decode Error - Formato Json incorrecto")
 def test_loop_2_times(self):
     my_key = AccessManager()
     result = my_key.open_door(
         "d08ce21f3b9c2da48445507518c7e556a0e6c6fb94fd6f3ae3f8307e4705b909")
     self.assertEqual(True, result)
 def test_loop_1_times(self):
     my_key = AccessManager()
     result = my_key.open_door(
         "821c9d9cf4ab2255fd53a8365042a12f49f183e82b811f8ae2dc3ebe941b3bb4")
     self.assertEqual(True, result)
 def test_loop_0_times(self):
     my_key = AccessManager()
     with self.assertRaises(AccessManagementException) as AME:
         result = my_key.check_key("x")
     self.assertEqual(AME.exception.message, "Clave invalida")
 def test_open_door_clave_no_exp(self):
     my_key = AccessManager()
     result = my_key.open_door(
         "5612e8c1d700d1268481a80600bb19d1529e158de6a7e77e00afd77297337596")
     self.assertEqual(True, result)
 def test_read_key_file_fichero_datos(self):
     my_key = AccessManager()
     result = my_key.open_door(
         "821c9d9cf4ab2255fd53a8365042a12f49f183e82b811f8ae2dc3ebe941b3bb4")
     self.assertEqual(True, result)
 def test_check_key_clave_valida(self):
     my_key = AccessManager()
     result = my_key.check_key(
         "821c9d9cf4ab2255fd53a8365042a12f49f183e82b811f8ae2dc3ebe941b3bb4")
     self.assertEqual(True, result)
예제 #12
0
 def test_AM_FR_01_I1_dni_valido(self):
     ar = AccessManager()
     ac = ar.request_access_code(id_document="12345678Z", full_name="Beatriz Benitez",
                                 access_type="Guest", email_address="*****@*****.**", validity=3)
     self.assertEqual(ac, "299350376deadf07044aaa5035f93a6f")
예제 #13
0
 def test_AM_FR_01_I2_resident(self):
     ar = AccessManager()
     ac = ar.request_access_code(id_document="12345678Z", full_name="Beatriz Benitez",
                        access_type="Resident", email_address="*****@*****.**", validity=0)
     self.assertEqual(ac, "eeadab980b4ae41412aed7a991750fab")