Adds a test case for the infinite recursion bug in issue #598.

The bug requires TEMPLATE_DEBUG=True, for the template to extend
another template and SQL to be run in the template loader.
With this configuration the SQL Panel would identify the SQL query
while loading the template, then try to load the template again which
would create a new SQL query ending in an infinite recursion.