Fixed #23768 -- Rewrote template tests as unit tests

again, I wonder if there's an advantage to running every single test with `TEMPLATE_DEBUG=True/False` or if we can just use override_settings to modify it for the tests that care.