Fix unit tests with Flask-SQLAlchemy patch

This is a temporary patch, awaiting pull request upstream [1].

[1] https://github.com/mitsuhiko/flask-sqlalchemy/pull/135