Refactor code formatting in locustfile.py

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-01-25 16:16:03 -03:00
commit a0f7e63f77

View file

@ -66,7 +66,9 @@ class NameTest(FastHttpUser):
result1, session_id = self.process(name, self.flow_id, payload1)
payload2 = {
"inputs": {"text": "What is my name? Please, answer like this: Your name is <name>"},
"inputs": {
"text": "What is my name? Please, answer like this: Your name is <name>"
},
"session_id": session_id,
"sync": False,
}
@ -86,7 +88,9 @@ class NameTest(FastHttpUser):
logged_in_headers = {"Authorization": f"Bearer {a_token}"}
print("Logged in")
with open(
Path(__file__).parent.parent / "data" / "BasicChatwithPromptandHistory.json",
Path(__file__).parent.parent
/ "data"
/ "BasicChatwithPromptandHistory.json",
"r",
) as f:
json_flow = f.read()
@ -111,7 +115,11 @@ class NameTest(FastHttpUser):
)
print(response.json())
user_id = next(
(user["id"] for user in response.json()["users"] if user["username"] == "superuser"),
(
user["id"]
for user in response.json()["users"]
if user["username"] == "superuser"
),
None,
)
# Create api key