test: add empty api keys to audiogen test
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Yandrik 2024-04-25 15:43:32 +02:00
parent 7455b05c15
commit 021abfd297

View File

@ -14,7 +14,7 @@ class TestAudioGeneratorValidate(TestCase):
{"type": "section_end"}, {"type": "section_end"},
{"type": "insert_section", "section_id": 1}, {"type": "insert_section", "section_id": 1},
] ]
self.audio_generator = AudioGenerator(self.valid_parsed_data, "test_output.mp3") self.audio_generator = AudioGenerator(self.valid_parsed_data, "test_output.mp3", api_key="")
def test_validate_voices_valid(self): def test_validate_voices_valid(self):
self.audio_generator.validate_voices() self.audio_generator.validate_voices()
@ -25,7 +25,7 @@ class TestAudioGeneratorValidate(TestCase):
{"type": "voice", "voice": "invalid_voice"}, {"type": "voice", "voice": "invalid_voice"},
{"type": "text", "text": "Hello, world!"}, {"type": "text", "text": "Hello, world!"},
] ]
invalid_audio_generator = AudioGenerator(invalid_parsed_data, "test_output.mp3") invalid_audio_generator = AudioGenerator(invalid_parsed_data, "test_output.mp3", api_key="")
with self.assertRaises(ValueError) as cm: with self.assertRaises(ValueError) as cm:
invalid_audio_generator.validate_voices() invalid_audio_generator.validate_voices()
self.assertEqual(str(cm.exception), "Invalid voice(s) found: invalid_voice") self.assertEqual(str(cm.exception), "Invalid voice(s) found: invalid_voice")
@ -40,12 +40,13 @@ class TestAudioGeneratorValidate(TestCase):
{"type": "text", "text": "Hello, world!"}, {"type": "text", "text": "Hello, world!"},
{"type": "insert_section", "section_id": 1}, {"type": "insert_section", "section_id": 1},
] ]
invalid_audio_generator = AudioGenerator(invalid_parsed_data, "test_output.mp3") invalid_audio_generator = AudioGenerator(invalid_parsed_data, "test_output.mp3", api_key="")
with self.assertRaises(ValueError) as cm: with self.assertRaises(ValueError) as cm:
invalid_audio_generator.validate_sections() invalid_audio_generator.validate_sections()
self.assertIn("Section 1 is used before being defined.", str(cm.exception)) self.assertIn("Section 1 is used before being defined.", str(cm.exception))
self.assertIn("Undefined section(s) used: 1", str(cm.exception)) self.assertIn("Undefined section(s) used: 1", str(cm.exception))
# @patch('builtins.input', return_value='no') # @patch('builtins.input', return_value='no')
# @patch('audiogen.AudioGenerator.text_to_speech') # @patch('audiogen.AudioGenerator.text_to_speech')
# def test_text_to_speech_retry_logic(self, mock_text_to_speech, mock_input): # def test_text_to_speech_retry_logic(self, mock_text_to_speech, mock_input):