🐛 fix(basic_example.json): change value of "value" key from "abc" to null to remove hardcoded value and improve flexibility

 test(test_user.py): add test to create a super user for testing purposes and ensure it returns the correct response
🔥 chore(utils.py): remove unused functions run_post and poll_task_status to clean up code
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-09-22 11:06:25 -03:00
commit 416d294117
3 changed files with 4 additions and 29 deletions

View file

@ -236,7 +236,7 @@
"placeholder": "",
"show": true,
"multiline": false,
"value": "abc",
"value": null,
"password": true,
"name": "openai_api_key",
"display_name": "OpenAI API Key",

View file

@ -213,7 +213,9 @@ def test_normal_user_cant_delete_user(client, test_user, logged_in_headers):
# If you still want to test the superuser endpoint
def test_add_super_user_for_testing_purposes_delete_me_before_merge_into_dev(client):
def test_add_super_user_for_testing_purposes_delete_me_before_merge_into_dev(
client,
):
response = client.post("/api/v1/super_user")
assert response.status_code == 200
assert response.json()["username"] == "superuser"

View file

@ -1,27 +0,0 @@
import time
def run_post(client, flow_id, headers, post_data):
response = client.post(
f"api/v1/process/{flow_id}",
headers=headers,
json=post_data,
)
assert response.status_code == 200, response.json()
return response.json()
# Helper function to poll task status
def poll_task_status(client, headers, task_id, max_attempts=20, sleep_time=1):
for _ in range(max_attempts):
task_status_response = client.get(
f"api/v1/task/{task_id}/status",
headers=headers,
)
if (
task_status_response.status_code == 200
and task_status_response.json()["status"] == "SUCCESS"
):
return task_status_response.json()
time.sleep(sleep_time)
return None # Return None if task did not complete in time