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-Maintenance-Anal.../src/djangoblog/tests.py

42 lines
1.0 KiB

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.

from django.test import TestCase
from djangoblog.utils import get_sha256, CommonMarkdown
class DjangoBlogTest(TestCase):
"""
sh:
项目核心工具类单元测试类:验证工具函数的功能正确性
继承Django的TestCase提供测试环境和断言方法
"""
def setUp(self):
"""
测试前置准备方法:在每个测试方法执行前运行
此处原代码抛出未实现异常,实际使用时可添加初始化逻辑(如创建测试数据)
"""
raise NotImplementedError("setUp method is not supported yet")
def test_utils(self):
md5 = get_sha256('test')
self.assertIsNotNone(md5)
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)