From 416d2941174c8faf4672d607cf4d348f5550076d Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 22 Sep 2023 11:06:25 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(basic=5Fexample.json):=20cha?= =?UTF-8?q?nge=20value=20of=20"value"=20key=20from=20"abc"=20to=20null=20t?= =?UTF-8?q?o=20remove=20hardcoded=20value=20and=20improve=20flexibility=20?= =?UTF-8?q?=E2=9C=85=20test(test=5Fuser.py):=20add=20test=20to=20create=20?= =?UTF-8?q?a=20super=20user=20for=20testing=20purposes=20and=20ensure=20it?= =?UTF-8?q?=20returns=20the=20correct=20response=20=F0=9F=94=A5=20chore(ut?= =?UTF-8?q?ils.py):=20remove=20unused=20functions=20run=5Fpost=20and=20pol?= =?UTF-8?q?l=5Ftask=5Fstatus=20to=20clean=20up=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/data/basic_example.json | 2 +- tests/test_user.py | 4 +++- tests/utils.py | 27 --------------------------- 3 files changed, 4 insertions(+), 29 deletions(-) diff --git a/tests/data/basic_example.json b/tests/data/basic_example.json index 2c08512bb0..35f515bc49 100644 --- a/tests/data/basic_example.json +++ b/tests/data/basic_example.json @@ -236,7 +236,7 @@ "placeholder": "", "show": true, "multiline": false, - "value": "abc", + "value": null, "password": true, "name": "openai_api_key", "display_name": "OpenAI API Key", diff --git a/tests/test_user.py b/tests/test_user.py index 9c41533169..c0a0205546 100644 --- a/tests/test_user.py +++ b/tests/test_user.py @@ -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" diff --git a/tests/utils.py b/tests/utils.py index a4bae9863e..e69de29bb2 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -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