25 lines
867 B
Python
25 lines
867 B
Python
from django.test import TestCase
|
|
from django.urls import reverse
|
|
from .audio.AudioService import get_audio_service
|
|
|
|
class YourModelTest(TestCase):
|
|
|
|
def test_audio(self):
|
|
# 在这里设置测试所需的初始数据
|
|
# YourModel.objects.create(name="TestName", value="TestValue")
|
|
|
|
audio_ser = get_audio_service()
|
|
audio_ser.synthesize_speech('你好,你是谁啊')
|
|
|
|
|
|
# def test_model_creation(self):
|
|
# # 测试模型是否正确创建
|
|
# obj = YourModel.objects.get(name="TestName")
|
|
# self.assertEqual(obj.value, "TestValue")
|
|
|
|
# def test_view_response(self):
|
|
# # 测试视图是否返回正确的响应
|
|
# response = self.client.get(reverse('your_view_name'))
|
|
# self.assertEqual(response.status_code, 200)
|
|
# self.assertContains(response, "Expected content")
|