-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlocustfile.py
More file actions
39 lines (28 loc) · 943 Bytes
/
locustfile.py
File metadata and controls
39 lines (28 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from locust import HttpUser, between, task
from locust.contrib.fasthttp import FastHttpUser
import random
import database as db
with db.db_session:
chall_uuids = db.select(s.uuid for s in db.Challenge)[:]
user_api_keys = db.select(u.api_key for u in db.User)[:]
class WebsiteUser(FastHttpUser):
wait_time = between(1, 2)
@task
def index(self):
self.client.get("/")
@task
def about(self):
self.client.get("/hud")
@task
def about(self):
self.client.get(f"/hud/{random.choice(user_api_keys)}")
@task
def about(self):
self.client.get("/hud/transactions")
@task
def about(self):
self.client.get(f"/chall/{random.choice(chall_uuids)}")
# @task
# def search(self):
# terms = ['hacking', '%20', 'iteration', 'loop', 'bool', 'robotics', 'impacts', 'switch' ]
# self.client.get(f'/api/v1/search?query={random.choice(terms)}')