Refactor code formatting in locustfile.py
This commit is contained in:
parent
517529ca40
commit
a0f7e63f77
1 changed files with 11 additions and 3 deletions
|
|
@ -66,7 +66,9 @@ class NameTest(FastHttpUser):
|
||||||
result1, session_id = self.process(name, self.flow_id, payload1)
|
result1, session_id = self.process(name, self.flow_id, payload1)
|
||||||
|
|
||||||
payload2 = {
|
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,
|
"session_id": session_id,
|
||||||
"sync": False,
|
"sync": False,
|
||||||
}
|
}
|
||||||
|
|
@ -86,7 +88,9 @@ class NameTest(FastHttpUser):
|
||||||
logged_in_headers = {"Authorization": f"Bearer {a_token}"}
|
logged_in_headers = {"Authorization": f"Bearer {a_token}"}
|
||||||
print("Logged in")
|
print("Logged in")
|
||||||
with open(
|
with open(
|
||||||
Path(__file__).parent.parent / "data" / "BasicChatwithPromptandHistory.json",
|
Path(__file__).parent.parent
|
||||||
|
/ "data"
|
||||||
|
/ "BasicChatwithPromptandHistory.json",
|
||||||
"r",
|
"r",
|
||||||
) as f:
|
) as f:
|
||||||
json_flow = f.read()
|
json_flow = f.read()
|
||||||
|
|
@ -111,7 +115,11 @@ class NameTest(FastHttpUser):
|
||||||
)
|
)
|
||||||
print(response.json())
|
print(response.json())
|
||||||
user_id = next(
|
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,
|
None,
|
||||||
)
|
)
|
||||||
# Create api key
|
# Create api key
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue