Browse Source

fixed locust config

master
konrad 2 years ago
parent
commit
b3b4d75130
Signed by: konrad GPG Key ID: F40E70337AB24C9B
  1. 1
      create_users.sh
  2. 3
      locust_file.py

1
create_users.sh

@ -5,4 +5,5 @@ do
data="{\"username\":\"testuser${f}\",\"email\":\"testuser${f}@kolaente.de\",\"password\":\"1234\"}"
#echo $data
curl 'http://localhost:8080/api/v1/register' -H "accept: application/json" -H "Content-Type: application/json" -X POST -d ${data}
echo "";
done

3
locust_file.py

@ -14,13 +14,14 @@ class VikunjaTaskSet(TaskSequence):
'content-type': "application/json",
'Authorization': ""
}
# Append your login or authentication keys to header
self.get_authentication_keys()
self.listIDs = []
self.namespaces = {}
def get_authentication_keys(self):
response = self.client.post("/login", {"username":"testuser" + str(random.randint(1, 100)), "password":"1234"})
response = self.client.post("/login", '{"username":"testuser' + str(random.randint(1, 100)) + '", "password":"1234"}', headers=self.headers)
data = json.loads(response.text)
self.headers["Authorization"] = 'Bearer ' + data["token"]

Loading…
Cancel
Save