fix missing auth header in locust tests
This commit is contained in:
parent
3e999f8b60
commit
64759c2227
@ -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,
|
||||
"password": password,
|
||||
"name": randName,
|
||||
},
|
||||
)
|
||||
@ -41,7 +27,7 @@ class DummyRoute(FastHttpUser):
|
||||
"/user/login",
|
||||
json={
|
||||
"email": randEmail,
|
||||
"password":randPassword,
|
||||
"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}
|
||||
self.headers = {"X-Auth": token}
|
||||
Loading…
x
Reference in New Issue
Block a user