Fix variable name and simplify if statements
This commit is contained in:
parent
1a8891134c
commit
4daf4ffc81
3 changed files with 519 additions and 34 deletions
|
|
@ -87,7 +87,7 @@ module.exports = {
|
||||||
"beta-foreground": "var(--beta-foreground)",
|
"beta-foreground": "var(--beta-foreground)",
|
||||||
"chat-bot-icon": "var(--chat-bot-icon)",
|
"chat-bot-icon": "var(--chat-bot-icon)",
|
||||||
"chat-user-icon": "var(--chat-user-icon)",
|
"chat-user-icon": "var(--chat-user-icon)",
|
||||||
"ice": "var(--ice)",
|
ice: "var(--ice)",
|
||||||
|
|
||||||
white: "var(--white)",
|
white: "var(--white)",
|
||||||
border: "hsl(var(--border))",
|
border: "hsl(var(--border))",
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -29,10 +29,7 @@ def poll_task_status(client, headers, href, max_attempts=20, sleep_time=1):
|
||||||
href,
|
href,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
)
|
)
|
||||||
if (
|
if task_status_response.status_code == 200 and task_status_response.json()["status"] == "SUCCESS":
|
||||||
task_status_response.status_code == 200
|
|
||||||
and task_status_response.json()["status"] == "SUCCESS"
|
|
||||||
):
|
|
||||||
return task_status_response.json()
|
return task_status_response.json()
|
||||||
time.sleep(sleep_time)
|
time.sleep(sleep_time)
|
||||||
return None # Return None if task did not complete in time
|
return None # Return None if task did not complete in time
|
||||||
|
|
@ -126,11 +123,7 @@ def created_api_key(active_user):
|
||||||
)
|
)
|
||||||
db_manager = get_db_service()
|
db_manager = get_db_service()
|
||||||
with session_getter(db_manager) as session:
|
with session_getter(db_manager) as session:
|
||||||
if (
|
if existing_api_key := session.query(ApiKey).filter(ApiKey.api_key == api_key.api_key).first():
|
||||||
existing_api_key := session.query(ApiKey)
|
|
||||||
.filter(ApiKey.api_key == api_key.api_key)
|
|
||||||
.first()
|
|
||||||
):
|
|
||||||
return existing_api_key
|
return existing_api_key
|
||||||
session.add(api_key)
|
session.add(api_key)
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
@ -296,11 +289,7 @@ def test_get_all(client: TestClient, logged_in_headers):
|
||||||
dir_reader = DirectoryReader(settings.COMPONENTS_PATH[0])
|
dir_reader = DirectoryReader(settings.COMPONENTS_PATH[0])
|
||||||
files = dir_reader.get_files()
|
files = dir_reader.get_files()
|
||||||
# json_response is a dict of dicts
|
# json_response is a dict of dicts
|
||||||
all_names = [
|
all_names = [component_name for _, components in response.json().items() for component_name in components]
|
||||||
component_name
|
|
||||||
for _, components in response.json().items()
|
|
||||||
for component_name in components
|
|
||||||
]
|
|
||||||
json_response = response.json()
|
json_response = response.json()
|
||||||
# We need to test the custom nodes
|
# We need to test the custom nodes
|
||||||
assert len(all_names) > len(files)
|
assert len(all_names) > len(files)
|
||||||
|
|
@ -425,19 +414,13 @@ def test_various_prompts(client, prompt, expected_input_variables):
|
||||||
|
|
||||||
|
|
||||||
def test_get_vertices_flow_not_found(client, logged_in_headers):
|
def test_get_vertices_flow_not_found(client, logged_in_headers):
|
||||||
response = client.get(
|
response = client.get("/api/v1/build/nonexistent_id/vertices", headers=logged_in_headers)
|
||||||
"/api/v1/build/nonexistent_id/vertices", headers=logged_in_headers
|
assert response.status_code == 500 # Or whatever status code you've set for invalid ID
|
||||||
)
|
|
||||||
assert (
|
|
||||||
response.status_code == 500
|
|
||||||
) # Or whatever status code you've set for invalid ID
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_vertices(client, added_flow_with_prompt_and_history, logged_in_headers):
|
def test_get_vertices(client, added_flow_with_prompt_and_history, logged_in_headers):
|
||||||
flow_id = added_flow_with_prompt_and_history["id"]
|
flow_id = added_flow_with_prompt_and_history["id"]
|
||||||
response = client.get(
|
response = client.get(f"/api/v1/build/{flow_id}/vertices", headers=logged_in_headers)
|
||||||
f"/api/v1/build/{flow_id}/vertices", headers=logged_in_headers
|
|
||||||
)
|
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert "ids" in response.json()
|
assert "ids" in response.json()
|
||||||
# The response should contain the list in this order
|
# The response should contain the list in this order
|
||||||
|
|
@ -453,19 +436,13 @@ def test_get_vertices(client, added_flow_with_prompt_and_history, logged_in_head
|
||||||
|
|
||||||
|
|
||||||
def test_build_vertex_invalid_flow_id(client, logged_in_headers):
|
def test_build_vertex_invalid_flow_id(client, logged_in_headers):
|
||||||
response = client.post(
|
response = client.post("/api/v1/build/nonexistent_id/vertices/vertex_id", headers=logged_in_headers)
|
||||||
"/api/v1/build/nonexistent_id/vertices/vertex_id", headers=logged_in_headers
|
|
||||||
)
|
|
||||||
assert response.status_code == 500
|
assert response.status_code == 500
|
||||||
|
|
||||||
|
|
||||||
def test_build_vertex_invalid_vertex_id(
|
def test_build_vertex_invalid_vertex_id(client, added_flow_with_prompt_and_history, logged_in_headers):
|
||||||
client, added_flow_with_prompt_and_history, logged_in_headers
|
|
||||||
):
|
|
||||||
flow_id = added_flow_with_prompt_and_history["id"]
|
flow_id = added_flow_with_prompt_and_history["id"]
|
||||||
response = client.post(
|
response = client.post(f"/api/v1/build/{flow_id}/vertices/invalid_vertex_id", headers=logged_in_headers)
|
||||||
f"/api/v1/build/{flow_id}/vertices/invalid_vertex_id", headers=logged_in_headers
|
|
||||||
)
|
|
||||||
assert response.status_code == 500
|
assert response.status_code == 500
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue