from django.test import SimpleTestCase from helpdesk.models import get_markdown class MarkDown(SimpleTestCase): """Test work Markdown functional""" def test_markdown_html_tab(self): expected_value = "
<div>test<div>
" input_value = "Line 1
\n Line 2
# import os\n
'
input_value = """
# Title
```python
# import os
```
"""
output_value = get_markdown(input_value)
self.assertEqual(output_value, expected_value)
def test_markdown_link_correct_protokol(self):
expected_value = ''
input_value = "[www.google.com](http://www.yahoo.ru)"
output_value = get_markdown(input_value)
self.assertEqual(output_value, expected_value)
def test_markdown_link_not_correct_protokol(self):
expected_value = ''
input_value = "[www.google.com](aaaa://www.yahoo.ru)"
output_value = get_markdown(input_value)
self.assertEqual(output_value, expected_value)