Skip to content

Instantly share code, notes, and snippets.

@hslavich
Created February 19, 2015 21:53
Show Gist options
  • Save hslavich/d0f99733966789b67597 to your computer and use it in GitHub Desktop.
Save hslavich/d0f99733966789b67597 to your computer and use it in GitHub Desktop.
from locust import HttpLocust, TaskSet, task
import re
class MyTaskSet(TaskSet):
def on_start(self):
self.login()
def login(self):
r = self.client.get("/")
response = self.client.post(r.url, {
"username": "user",
"password": "pass",
}, name = "SAML Idp login")
saml_data = re.search(r'input type="hidden" name="SAMLResponse" value="(\S+)" />', response.content)
self.client.post("/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp", data = {
"SAMLResponse": saml_data.group(1)
}, name = "SAML SP login post")
@task
def index(self):
self.client.get("/")
@task
def consumos(self):
self.client.get("/kilme/consumos")
@task
def asistencia(self):
self.client.get("/asistencia/")
@task
def asistencia_balance(self):
self.client.get("/asistencia/balance")
@task
def asistencia_inasistencias(self):
self.client.get("/asistencia/inasistencias")
@task
def asistencia_inconsistencias(self):
self.client.get("/asistencia/inconsistencias")
@task
def asistencia_licencias(self):
self.client.get("/asistencia/licencias")
# @task
# def agente_cargos(self):
# self.client.get("/mapuche/agente")
# @task
# def agente_domicilios(self):
# self.client.get("/mapuche/agente/domicilios")
# @task
# def agente_familiares(self):
# self.client.get("/mapuche/agente/familiares")
# @task
# def recibos(self):
# self.client.get("/mapuche/recibos")
class MyLocusst(HttpLocust):
task_set = MyTaskSet
host = "https://mi.unq.edu.ar"
min_wait = 5000
max_wait = 10000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment