import unittest import os import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).parent.parent)) import src.utils.config_manager as config class TestOmniVoiceConfig(unittest.TestCase): def setUp(self): self.config = config.config self.config.reset() def test_register_params(self): from modules.omnivoice.config import register_params from modules.omnivoice.config import ( MODEL_NAME, DEVICE, DTYPE, NUM_STEPS, SPEED, PROFILES_DIR, OUTPUT_DIR, ENABLED, DEFAULT_MODEL_NAME, DEFAULT_DEVICE, ) register_params() self.assertEqual( self.config.get(MODEL_NAME, cat="omnivoice"), DEFAULT_MODEL_NAME, ) self.assertEqual( self.config.get(DEVICE, cat="omnivoice"), DEFAULT_DEVICE, ) class TestOmniVoiceAPI(unittest.TestCase): def test_api_import(self): from modules.omnivoice.api import VoiceAPI api = VoiceAPI() self.assertIsNotNone(api) class TestOmniVoiceProfiles(unittest.TestCase): def setUp(self): import tempfile self.temp_dir = tempfile.mkdtemp() from modules.omnivoice.profiles import VoiceProfiles self.profiles = VoiceProfiles(self.temp_dir) def test_profile_create(self): from modules.omnivoice.profiles import VoiceProfile profile = VoiceProfile( name="test", ref_audio="ref.wav", ref_text="test text", description="test profile", ) self.assertEqual(profile.name, "test") self.assertEqual(profile.mode, "clone") def test_profile_instruct_mode(self): from modules.omnivoice.profiles import VoiceProfile profile = VoiceProfile( name="test_design", instruct="female, british", description="test design", ) self.assertEqual(profile.mode, "design") def test_profile_auto_mode(self): from modules.omnivoice.profiles import VoiceProfile profile = VoiceProfile( name="test_auto", description="test auto", ) self.assertEqual(profile.mode, "auto") class TestOmniVoiceCLI(unittest.TestCase): def test_cli_import(self): from modules.omnivoice import cli self.assertTrue(hasattr(cli, "main")) if __name__ == "__main__": unittest.main()