mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-25 01:13:31 +01:00
Fix. Fix problem wich version package in requirements and add test markdown
This commit is contained in:
parent
645ce17c6f
commit
a28569a984
44
helpdesk/tests/test_markdown.py
Normal file
44
helpdesk/tests/test_markdown.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
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 = "<p><div>test<div></p>"
|
||||||
|
input_value = "<div>test<div>"
|
||||||
|
output_value = get_markdown(input_value)
|
||||||
|
self.assertEqual(output_value, expected_value)
|
||||||
|
|
||||||
|
def test_markdown_nl2br(self):
|
||||||
|
""" warning, after Line 1 - two withespace, esle did't work"""
|
||||||
|
expected_value = "<p>Line 1<br />\n Line 2</p>"
|
||||||
|
input_value = """Line 1
|
||||||
|
Line 2"""
|
||||||
|
output_value = get_markdown(input_value)
|
||||||
|
self.assertEqual(output_value, expected_value)
|
||||||
|
|
||||||
|
def test_markdown_fenced_code(self):
|
||||||
|
expected_value = '<h1>Title</h1>\n<pre><code class="python"># import os\n</code></pre>'
|
||||||
|
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 = '<p><a href="http://www.yahoo.ru">www.google.com</a></p>'
|
||||||
|
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 = '<p><a href="//www.yahoo.ru">www.google.com</a></p>'
|
||||||
|
input_value = "[www.google.com](aaaa://www.yahoo.ru)"
|
||||||
|
output_value = get_markdown(input_value)
|
||||||
|
self.assertEqual(output_value, expected_value)
|
Loading…
Reference in New Issue
Block a user