From aa0164e27dac01f688e4d571ba11777c7f17a101 Mon Sep 17 00:00:00 2001 From: Bjoern Boschman Date: Sat, 8 Aug 2020 10:11:51 +0200 Subject: [PATCH] added testcases --- .../multiple_template_engines.py | 16 ++++++++++ tests/browsable_api/test_browsable_api.py | 31 ++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tests/browsable_api/multiple_template_engines.py diff --git a/tests/browsable_api/multiple_template_engines.py b/tests/browsable_api/multiple_template_engines.py new file mode 100644 index 000000000..59072aaf8 --- /dev/null +++ b/tests/browsable_api/multiple_template_engines.py @@ -0,0 +1,16 @@ +TEMPLATES = [ + { + "BACKEND": "django_jinja.backend.Jinja2", + "APP_DIRS": True, + "OPTIONS": { + "match_extension": ".html", + } + }, + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'APP_DIRS': True, + 'OPTIONS': { + "debug": True, # We want template errors to raise + } + }, +] diff --git a/tests/browsable_api/test_browsable_api.py b/tests/browsable_api/test_browsable_api.py index 17644c2ac..0ec57625a 100644 --- a/tests/browsable_api/test_browsable_api.py +++ b/tests/browsable_api/test_browsable_api.py @@ -1,8 +1,11 @@ from django.contrib.auth.models import User -from django.test import TestCase, override_settings +from django.test import Client, TestCase, override_settings +from jinja2.exceptions import TemplateSyntaxError from rest_framework.test import APIClient +from .multiple_template_engines import TEMPLATES + @override_settings(ROOT_URLCONF='tests.browsable_api.auth_urls') class DropdownWithAuthTests(TestCase): @@ -72,3 +75,29 @@ class NoDropdownWithoutAuthTests(TestCase): response = self.client.get('/') content = response.content.decode() assert '