Fixed #23300 -- Made assertTemplateUsed throw an error on responses not fetched using the test client.

Thanks zags for the report and bmispelon for the patch.