forked from watson-developer-cloud/python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_integration_text_to_speech_v1.py
More file actions
32 lines (22 loc) · 1.26 KB
/
Copy pathtest_integration_text_to_speech_v1.py
File metadata and controls
32 lines (22 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import pytest
import unittest
import watson_developer_cloud
import os
@pytest.mark.skip("These are destructive, so run them manually")
class TestIntegrationTextToSpeechV1(unittest.TestCase):
def setUp(self):
self.text_to_speech = watson_developer_cloud.TextToSpeechV1(username=os.getenv('TEXT_TO_SPEECH_USERNAME'),
password=os.getenv('TEXT_TO_SPEECH_PASSWORD'))
self.original_customizations = self.text_to_speech.customizations()
self.created_customization = self.text_to_speech.create_customization(name="test_integration_customization",
description="customization for tests")
def tearDown(self):
custid = self.created_customization['customization_id']
self.text_to_speech.delete_customization(customization_id=custid)
def test_customizations(self):
old_length = len(self.original_customizations['customizations'])
new_length = len(self.text_to_speech.customizations()['customizations'])
assert new_length - old_length == 1
def test_speak(self):
output = self.text_to_speech.synthesize(text="my voice is my passport")
assert len(output) > 0