mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-11-20 18:06:02 -05:00
Fix issue in GC (#54)
* Update sql to map uuid to token Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Fix millis to secs conversion Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Add synchronisation to media enpoint DB access Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Change error code for rate limiter Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * move prepared statements to Thread Local Storage * Change test end points * init GC * Add GC Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Change status return Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Auto generate token in db Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Remove user management and rate limiting Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Add seed for random number generator Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Store random instance as class member Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Update locustfile Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Add API documentation Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Move updateTimeStamp to getChallenge methdod Remove user tables for the DB Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Update Timestamp when creating mapId entry Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Add request method type Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Minor fixes Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Fix issue in GC Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Change db directory Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Update locust test Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Update .gitignore
This commit is contained in:
committed by
GitHub
parent
5c3bdfeb83
commit
b16c2698d2
@@ -1,41 +1,37 @@
|
||||
from locust import task, between, SequentialTaskSet
|
||||
from locust.contrib.fasthttp import FastHttpUser
|
||||
import json
|
||||
import uuid
|
||||
|
||||
class QuickStartUser(SequentialTaskSet):
|
||||
wait_time = between(0.1,1)
|
||||
|
||||
captcha_params = {"level":"some","media":"some","input_type":"some"}
|
||||
answerBody = {"answer": "qwer123"}
|
||||
|
||||
@task
|
||||
def captcha(self):
|
||||
resp = self.client.post(path="/v1/captcha", json=self.captcha_params, name="/captcha")
|
||||
captcha_params = {"level":"some","media":"some","input_type":"some"}
|
||||
|
||||
resp = self.client.post(path="/v1/captcha", json=captcha_params, name="/captcha")
|
||||
if resp.status_code != 200:
|
||||
print("\nError on /captcha endpoint: ")
|
||||
print(resp)
|
||||
print(resp.text)
|
||||
print("----------------END.C-------------------\n\n")
|
||||
self.answerBody["id"] = json.loads(resp.text).get("id")
|
||||
|
||||
uuid = json.loads(resp.text).get("id")
|
||||
answerBody = {"answer": "qwer123","id": uuid}
|
||||
|
||||
@task
|
||||
def media(self):
|
||||
resp = self.client.get(path="/v1/media?id=%s" % self.answerBody.get("id"), name="/media")
|
||||
resp = self.client.get(path="/v1/media?id=%s" % uuid, name="/media")
|
||||
if resp.status_code != 200:
|
||||
print("\nError on /media endpoint: ")
|
||||
print("\nError on /captcha endpoint: ")
|
||||
print(resp)
|
||||
print(resp.text)
|
||||
print("-----------------END.M-------------------\n\n")
|
||||
print("----------------END.C-------------------\n\n")
|
||||
|
||||
@task
|
||||
def answer(self):
|
||||
resp = self.client.post(path='/v1/answer', json=self.answerBody, name="/answer")
|
||||
resp = self.client.post(path='/v1/answer', json=answerBody, name="/answer")
|
||||
if resp.status_code != 200:
|
||||
print("\nError on /answer endpoint: ")
|
||||
print("\nError on /captcha endpoint: ")
|
||||
print(resp)
|
||||
print(resp.text)
|
||||
print("-------------------END.A---------------\n\n")
|
||||
print("----------------END.C-------------------\n\n")
|
||||
|
||||
|
||||
class User(FastHttpUser):
|
||||
|
||||
Reference in New Issue
Block a user