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:
Patrick Smith
2019-01-15 21:10:15 -05:00
parent b1348b52e5
commit ba97117a74
4 changed files with 119 additions and 33 deletions

16
tests/utils.py Normal file
View 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)