Add tests for portfolio funding route
This adds a helper to grab a template's context. Using a helper from the Flask documentation: http://flask.pocoo.org/docs/1.0/signals/?highlight=template_rendered#subscribing-to-signals
This commit is contained in:
16
tests/utils.py
Normal file
16
tests/utils.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from flask import template_rendered
|
||||
from contextlib import contextmanager
|
||||
|
||||
|
||||
@contextmanager
|
||||
def captured_templates(app):
|
||||
recorded = []
|
||||
|
||||
def record(sender, template, context, **extra):
|
||||
recorded.append((template, context))
|
||||
|
||||
template_rendered.connect(record, app)
|
||||
try:
|
||||
yield recorded
|
||||
finally:
|
||||
template_rendered.disconnect(record, app)
|
Reference in New Issue
Block a user