You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DjangoBlog/djangoblog/tests.py

39 lines
779 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#gq:
from django.test import TestCase
from djangoblog.utils import *
class DjangoBlogTest(TestCase):
"""测试 djangoblog.utils 模块的核心工具函数"""
def setUp(self):
pass
def test_utils(self):
# 测试SHA-256哈希生成
md5 = get_sha256('test')
self.assertIsNotNone(md5)
# 测试Markdown解析含标题、代码块、链接
c = CommonMarkdown.get_markdown('''
# Title1
```python
import os
```
[url](https://www.lylinux.net/)
[ddd](http://www.baidu.com)
''')
self.assertIsNotNone(c)
d = {
'd': 'key1',
'd2': 'key2'
}
data = parse_dict_to_url(d)
self.assertIsNotNone(data)