Esempio n. 1
0
def user_login():
    if request.method == "POST":
        return login.post()
    elif request.method == "DELETE":
        return login.delete()
    else:
        Response("Not Supported", mimetype="text/hmtl", status=500)
Esempio n. 2
0
 def test_no_loguea_usuario_invalido(self):
     with patch("login.get_dict_from_fieldstorage",
                return_value=self.FAKE_USER):
         with patch("login.get_orm", return_value=self.orm):
             alumno = Alumno(1, "Juancho", "m", 21,
                             sha256("OtraPassword".encode()).hexdigest())
             self.orm.create(alumno)
             pq = PyQuery(login.post())
             res = pq("div#form-success").text().lower().splitlines()
             self.assertListEqual(
                 res, [], msg="No se encontró el mensaje de login exitoso")
Esempio n. 3
0
 def test_loguea_usuario_valido(self):
     with patch("login.get_dict_from_fieldstorage",
                return_value=self.FAKE_USER):
         with patch("login.get_orm", return_value=self.orm):
             alumno = Alumno(
                 1, "Juancho", "m", 21,
                 sha256("UnaPasswordMuySegura".encode()).hexdigest())
             self.orm.create(alumno)
             pq = PyQuery(login.post())
             #splitear las lineas por el '\n' con "splitlines()"
             res = pq("div#form-success").text().lower().splitlines()
             self.assertEqual(res[0], "pudo ingresar correctamente")
Esempio n. 4
0
def login_api():

    if request.method == "POST":
        return login.post()
    elif request.method == "DELETE":
        return login.delete()
Esempio n. 5
0
 def POST(self):
     return login.post(session)