def test_language(self): doc = Doc() api = Api(title='test api', url='/test/', method='POST') api.body_example = '{}' doc.apis.append(api) html_en = doc.build() html_zh = doc.build(language='zh') self.assertIn('Contents', html_en) self.assertIn('Request Body Example', html_en) self.assertIn('Print This Document', html_en) self.assertIn('接口目录', html_zh) self.assertIn('示例请求数据', html_zh) self.assertIn('打印本文档', html_zh)
def test_body_example(self): doc = Doc() api = Api(title='test api', url='/test/', method='POST') api.body_example = """ { "username": "******", "password": "******" } """ doc.add_api(api) html = doc.build() self.assertIn('"username": "******"', html) self.assertIn('"password": "******"', html)