From 0b413d310922461900bdddc5b5cb84d88ac48b50 Mon Sep 17 00:00:00 2001
From: Fredrik Jonsson <frjo@xdeb.org>
Date: Mon, 10 Dec 2018 14:21:03 +0100
Subject: [PATCH] Add test for submission and markdown tags.

---
 opentech/apply/funds/tests/test_tags.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 opentech/apply/funds/tests/test_tags.py

diff --git a/opentech/apply/funds/tests/test_tags.py b/opentech/apply/funds/tests/test_tags.py
new file mode 100644
index 000000000..ccbd84b93
--- /dev/null
+++ b/opentech/apply/funds/tests/test_tags.py
@@ -0,0 +1,20 @@
+from django.template import Context, Template
+from django.test import override_settings, TestCase
+
+from opentech.apply.funds.tests.factories import ApplicationSubmissionFactory
+
+
+@override_settings(ROOT_URLCONF='opentech.apply.urls')
+class TestTemplateTags(TestCase):
+    def test_markdown_tags(self):
+        template = Template('{% load markdown_tags %}{{ content|markdown|safe }}')
+        context = Context({'content': 'Lorem ipsum **dolor** sit amet.'})
+        output = template.render(context)
+        self.assertEqual(output, '<p>Lorem ipsum <strong>dolor</strong> sit amet.</p>\n')
+
+    def test_submission_tags(self):
+        submission = ApplicationSubmissionFactory()
+        template = Template('{% load submission_tags %}{{ content|submission_links|safe }}')
+        context = Context({'content': f'Lorem ipsum dolor #{submission.id} sit amet.'})
+        output = template.render(context)
+        self.assertEqual(output, f'Lorem ipsum dolor <a href="{submission.get_absolute_url()}">{submission.title} <span class="mid-grey-text">#{submission.id}</span></a> sit amet.')
-- 
GitLab