Skip to content
Snippets Groups Projects
Verified Commit d1fcea56 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Added load testing test case

parent 6b5cb975
No related branches found
No related tags found
No related merge requests found
import os
import urllib.parse
from locust import HttpLocust, TaskSet, task
JWT_TOKEN = os.environ.get("JWT_TOKEN")
DATA = {"playable": True}
HEADERS = {}
if JWT_TOKEN:
print("Starting authenticated session")
HEADERS["authorization"] = "JWT {}".format(JWT_TOKEN)
class WebsiteTasks(TaskSet):
@task
def albums(self):
self.client.get(
"/api/v1/albums?" + urllib.parse.urlencode(DATA), headers=HEADERS
)
@task
def artists(self):
self.client.get(
"/api/v1/artists?" + urllib.parse.urlencode(DATA), headers=HEADERS
)
@task
def tracks(self):
self.client.get(
"/api/v1/tracks?" + urllib.parse.urlencode(DATA), headers=HEADERS
)
class WebsiteUser(HttpLocust):
task_set = WebsiteTasks
min_wait = 1000
max_wait = 3000
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment