From b3b4d7513028d431dad242e7b31b32689e6abbaf Mon Sep 17 00:00:00 2001 From: konrad Date: Thu, 17 Jan 2019 14:41:56 +0100 Subject: [PATCH] fixed locust config --- create_users.sh | 1 + locust_file.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/create_users.sh b/create_users.sh index 1fda4f6..5ccb344 100755 --- a/create_users.sh +++ b/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 diff --git a/locust_file.py b/locust_file.py index a772c0e..adf4208 100644 --- a/locust_file.py +++ b/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"]