diff --git a/load_tests/locustfile.py b/load_tests/locustfile.py index 3d463ca..aaeaedb 100644 --- a/load_tests/locustfile.py +++ b/load_tests/locustfile.py @@ -1,36 +1,22 @@ import random import string -from locust import FastHttpUser, task +from locust import HttpUser, FastHttpUser, task class DummyRoute(FastHttpUser): @task def dummy_test(self): - self.client.get("/dummy") - - # @task - # def user_create_test(self): - # randEmail = ''.join(random.choices(string.ascii_lowercase + string.digits, k=10)) + '@test.test' - # randPassword = ''.join(random.choices(string.ascii_letters + string.digits, k=10)) - # randName = ''.join(random.choices(string.ascii_letters, k=10)) - # self.client.post( - # "/user/create", - # json={ - # "email":randEmail, - # "password":randPassword, - # "name": randName, - # }, - # ) + self.client.get("/dummy", headers=self.headers) def on_start(self): randEmail = ''.join(random.choices(string.ascii_lowercase + string.digits, k=10)) + '@test.test' - randPassword = ''.join(random.choices(string.ascii_letters + string.digits, k=10)) randName = ''.join(random.choices(string.ascii_letters, k=10)) + password = 'Abcdef1!!1' response = self.client.post( "/user/create", json={ - "email":randEmail, - "password":randPassword, + "email": randEmail, + "password": password, "name": randName, }, ) @@ -40,8 +26,8 @@ class DummyRoute(FastHttpUser): response = self.client.post( "/user/login", json={ - "email":randEmail, - "password":randPassword, + "email": randEmail, + "password": password, }, ) if response.status_code != 200: @@ -51,4 +37,4 @@ class DummyRoute(FastHttpUser): if token == '': raise AssertionError('empty user token') - self.client.headers = {"X-Auth": token} \ No newline at end of file + self.headers = {"X-Auth": token} \ No newline at end of file