WIP: Add tests for http functions
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user