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.
This commit is contained in:
Eeshan Garg
2018-08-09 18:31:44 -02:30
committed by Tim Abbott
parent bf8557f4c2
commit 9e2a369e42

View File

@@ -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 <em>bold text</em>.'], 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 <em>bold text</em>.'], response)