From 36e1a822074e13183f5fdf44b4310323ed4bfd53 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 8 May 2024 17:03:04 -0700 Subject: [PATCH] Add test case to validate backend plugin load --- test/requirements.txt | 4 +++- test/unittests/test_service.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/test/requirements.txt b/test/requirements.txt index ce20b09..e6a8bed 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -4,4 +4,6 @@ pytest==5.2.4 pytest-cov==2.8.1 cov-core==1.15.0 sphinx==2.2.1 -sphinx-rtd-theme==0.4.3 \ No newline at end of file +sphinx-rtd-theme==0.4.3 +ovos-audio-plugin-simple~=0.0.1 +ovos-plugin-vlc~=0.0.1 \ No newline at end of file diff --git a/test/unittests/test_service.py b/test/unittests/test_service.py index 6bd86e0..bff46f8 100644 --- a/test/unittests/test_service.py +++ b/test/unittests/test_service.py @@ -222,6 +222,22 @@ def test_audio_service_queue_methods(self, mock_load_services): service.shutdown() + @mock.patch("ovos_audio.audio.Configuration") + def test_load_backends(self, mock_config): + mock_config.return_value = {} + service = AudioService(self.emitter) + service_names = set([s.name for s in service.service]) + self.assertEqual(service_names, + {"ovos_common_play", "ovos_vlc", "ovos_simple"}, + service_names) + service.shutdown() + + service = AudioService(self.emitter, disable_ocp=True) + service_names = [s.name for s in service.service] + self.assertEqual(service_names, {"ovos_vlc", "ovos_simple"}, + service_names) + service.shutdown() + if __name__ == "__main__": unittest.main()