WIP: Add tests for http functions

This commit is contained in:
Peter Stockings
2025-12-03 21:12:35 +11:00
parent c5eb1ce463
commit 049c875bc2
14 changed files with 979 additions and 69 deletions

View File

@@ -456,3 +456,30 @@ def restore(function_id):
except Exception as e:
print(e)
return jsonify({"status": "error", "message": str(e)}), 500
@http.route("/tests/<int:function_id>", methods=["GET"])
@login_required
def tests(function_id):
"""Render the tests page for a function"""
user_id = current_user.id
http_function = db.get_http_function_by_id(user_id, function_id)
if not http_function:
return jsonify({"error": "Function not found"}), 404
name = http_function["name"]
if htmx:
return render_block(
environment,
"dashboard/http_functions/tests.html",
"page",
function_id=function_id,
name=name
)
return render_template(
"dashboard/http_functions/tests.html",
function_id=function_id,
name=name
)