From 9e2a369e428d9acf3eebc901b532f9d79032e07b Mon Sep 17 00:00:00 2001 From: Eeshan Garg Date: Thu, 9 Aug 2018 18:31:44 -0230 Subject: [PATCH] render_markdown_path: Add test for templates with absolute paths. In certain cases we have to load a template directly because it isn't in Jinja2's recognized template directories. This commit adds a test to make sure that absolute paths are recognized if they are pure Markdown files. --- zerver/tests/test_templates.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zerver/tests/test_templates.py b/zerver/tests/test_templates.py index ad334c9b01..f2b6725e76 100644 --- a/zerver/tests/test_templates.py +++ b/zerver/tests/test_templates.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +import os import re from typing import Any, Dict, Iterable import logging @@ -256,3 +257,11 @@ class TemplateTestCase(ZulipTestCase): response = self.client_get('/privacy/') self.assert_in_success_response(['This is some bold text.'], response) self.assert_not_in_success_response([not_configured_message], response) + + def test_custom_privacy_policy_template_with_absolute_url(self) -> None: + current_dir = os.path.dirname(os.path.abspath(__file__)) + abs_path = os.path.join(current_dir, '..', '..', + 'templates/zerver/tests/markdown/test_markdown.md') + with self.settings(PRIVACY_POLICY=abs_path): + response = self.client_get('/privacy/') + self.assert_in_success_response(['This is some bold text.'], response)