Commit 4cf44483 by Karsa Zoltán István

load testing auth

parent eb6f5e2a
import json import json
from locust import HttpUser, task, between from locust import TaskSet, task, between, HttpUser
class PerformanceTests(HttpUser):
wait_time = between(1, 3)
class PerformanceTests(TaskSet):
def on_start(self): def on_start(self):
self.client.post("/user/login", { resp = self.client.post("/user/login", json={
"username": "karsa", "username": "karsa",
"password": "12345678" "password": "12345678"
}) })
self.client.headers = {'Authorization': 'Bearer ' + json.loads(resp._content)['access_token']}
@task(1) @task(1)
def testFastApi(self): def testFastApi(self):
self.client.get("/lb/dashboard/acpi/vm/1/") self.client.get("/lb/dashboard/acpi/vm/1/")
\ No newline at end of file
class WebsiteUser(HttpUser):
tasks = [PerformanceTests]
min_wait = 5000
max_wait = 9000
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment