Skip to content

Commit a8fa1d0

Browse files
committed
Improve the template_source view coverage a bit
1 parent 62f9bc4 commit a8fa1d0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_integration.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,26 @@ def test_template_source_checks_show_toolbar(self):
269269
)
270270
self.assertEqual(response.status_code, 404)
271271

272+
def test_template_source_errors(self):
273+
url = "/__debug__/template_source/"
274+
275+
response = self.client.get(url, {})
276+
self.assertContains(
277+
response, '"template_origin" key is required', status_code=400
278+
)
279+
280+
template = get_template("basic.html")
281+
response = self.client.get(
282+
url,
283+
{"template_origin": signing.dumps(template.template.origin.name) + "xyz"},
284+
)
285+
self.assertContains(response, '"template_origin" is invalid', status_code=400)
286+
287+
response = self.client.get(
288+
url, {"template_origin": signing.dumps("does_not_exist.html")}
289+
)
290+
self.assertContains(response, "Template Does Not Exist: does_not_exist.html")
291+
272292
def test_sql_select_checks_show_toolbar(self):
273293
url = "/__debug__/sql_select/"
274294
data = {

0 commit comments

Comments
 (0)