Skip to content
Snippets Groups Projects
Commit 0b413d31 authored by Fredrik Jonsson's avatar Fredrik Jonsson
Browse files

Add test for submission and markdown tags.

parent bba68cef
No related branches found
No related tags found
No related merge requests found
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.')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment