Closed havok2063 closed 7 years ago
Thanks for raising this issue -- good catch. Would you be comfortable submitting a PR to fix this and including your test cases in our own suite?
Yeah I think I can do that.
Great! I'm happy to provide support if needed
The errors could not be recreated using the source code, due to a difference between the source code, and the pip-installed code.
Source code 0.6.1:
raise AssertionError("Template %s not used. Templates were used: %s" % (name, ' '.join(repr(used_templates))))
Pip-installed code 0.6.1:
raise AssertionError("template %s not used. Templates were used: %s" % (name, ' '.join(used_templates)))
The source code has the Template object wrapped in repr
to format it into the string proper, whereas the pip-code does not. I suggest a new pip release be made to reflect this and any other changes that have been made. No fix was implemented but new tests were written nevertheless and I just submitted a new PR.
Duplicate of https://github.com/jarus/flask-testing/pull/96
It seems there's a bug when using the
assert_template_used
. When an improper template is specified, it fails to throw theAssertionError
. It looks like aTypeError
is thrown when attempting to throw theAssertionError
.Example test with wrong template specified. The correct template is
galaxy.html
and it works as expected when that is specified.index.html
is a real template, but incorrect one used inside this route. I've also tried simply a misspelled template name, and a blank template name, and all three cast this error.