Swift-Query / tests /test_render_assistant.py
Darshan Kumar R
Deploy to Hugging Face Spaces (Clean)
ed0b977
Raw History Blame Contribute Delete
863 Bytes
from flask import Flask, render_template, session
from utils.blueprints.assistant import assistant_bp
import os
app = Flask(__name__, template_folder='templates')
app.config['SECRET_KEY'] = 'test'
app.register_blueprint(assistant_bp)
# Mock mongo? The template iterates "patients".
# We can just render_template directly with calling the view function, or mock mongo.
# Easiest is to manually render the template file in a standalone context.
@app.route('/test_render')
def test():
session['user_name'] = 'Test Assistant'
patients = [{'id': 1, 'name': 'John Doe'}, {'id': 2, 'name': 'Jane Doe'}]
try:
return render_template('assistant/assistant_data_entry.html', patients=patients)
except Exception as e:
return f"ERROR: {e}"
if __name__ == "__main__":
with app.test_request_context('/test_render'):
print(test())