diff --git a/test/end2end/routing/test_session.py b/test/end2end/routing/test_session.py index 88b90ec32ad..f1cd842e3d3 100644 --- a/test/end2end/routing/test_session.py +++ b/test/end2end/routing/test_session.py @@ -93,7 +93,7 @@ def tearDown(self) -> None: self.core.stop() def test_no_session(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) messages = [] def new_msg(msg): @@ -121,7 +121,7 @@ def wait_for_n_messages(n): "converse", "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=True, player_state=PlayerState.STOPPED, media_state=MediaState.NO_MEDIA) utt = Message("recognizer_loop:utterance", diff --git a/test/end2end/session/test_blacklist.py b/test/end2end/session/test_blacklist.py index 342dfa5d79a..b2c9a2e609f 100644 --- a/test/end2end/session/test_blacklist.py +++ b/test/end2end/session/test_blacklist.py @@ -135,7 +135,7 @@ def tearDown(self) -> None: self.core.stop() def test_ocp(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) messages = [] def new_msg(msg): @@ -160,7 +160,7 @@ def wait_for_n_messages(n): pipeline=[ "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=True, player_state=PlayerState.STOPPED, media_state=MediaState.NO_MEDIA) utt = Message("recognizer_loop:utterance", diff --git a/test/end2end/session/test_ocp.py b/test/end2end/session/test_ocp.py index fc56bafca04..978ad2f1569 100644 --- a/test/end2end/session/test_ocp.py +++ b/test/end2end/session/test_ocp.py @@ -20,7 +20,7 @@ def tearDown(self) -> None: self.core.stop() def test_no_match(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) messages = [] def new_msg(msg): @@ -46,7 +46,7 @@ def wait_for_n_messages(n): "converse", "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=True, player_state=PlayerState.STOPPED, media_state=MediaState.NO_MEDIA) utt = Message("recognizer_loop:utterance", @@ -90,7 +90,7 @@ def wait_for_n_messages(n): self.assertEqual(m.msg_type, expected_messages[idx]) def test_player_info(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) messages = [] def new_msg(msg): @@ -112,8 +112,8 @@ def wait_for_n_messages(n): self.core.bus.on("message", new_msg) sess = Session("test-session", pipeline=["ocp_high"]) - if sess.session_id in self.core.intent_service.ocp.ocp_sessions: - self.core.intent_service.ocp.ocp_sessions.pop(sess.session_id) + if sess.session_id in self.core.intent_service._ocp.ocp_sessions: + self.core.intent_service._ocp.ocp_sessions.pop(sess.session_id) utt = Message("recognizer_loop:utterance", {"utterances": ["play something"]}, @@ -155,8 +155,8 @@ def wait_for_n_messages(n): for idx, m in enumerate(messages): self.assertEqual(m.msg_type, expected_messages[idx]) - self.assertFalse(self.core.intent_service.ocp.ocp_sessions[sess.session_id].ocp_available) - self.assertEqual(self.core.intent_service.ocp.ocp_sessions[sess.session_id].available_extractors, + self.assertFalse(self.core.intent_service._ocp.ocp_sessions[sess.session_id].ocp_available) + self.assertEqual(self.core.intent_service._ocp.ocp_sessions[sess.session_id].available_extractors, available_extractors()) # stream extractors handled in core before returning result # now test with OCP response @@ -168,8 +168,8 @@ def on_get(m): self.core.bus.on("ovos.common_play.SEI.get", on_get) - if sess.session_id in self.core.intent_service.ocp.ocp_sessions: - self.core.intent_service.ocp.ocp_sessions.pop(sess.session_id) + if sess.session_id in self.core.intent_service._ocp.ocp_sessions: + self.core.intent_service._ocp.ocp_sessions.pop(sess.session_id) self.core.bus.emit(utt) @@ -207,12 +207,12 @@ def on_get(m): for idx, m in enumerate(messages): self.assertEqual(m.msg_type, expected_messages[idx]) - self.assertTrue(self.core.intent_service.ocp.ocp_sessions[sess.session_id].ocp_available) - self.assertEqual(self.core.intent_service.ocp.ocp_sessions[sess.session_id].available_extractors, + self.assertTrue(self.core.intent_service._ocp.ocp_sessions[sess.session_id].ocp_available) + self.assertEqual(self.core.intent_service._ocp.ocp_sessions[sess.session_id].available_extractors, ["test"]) # test OCP player state sync - self.assertEqual(self.core.intent_service.ocp.ocp_sessions[sess.session_id].player_state, + self.assertEqual(self.core.intent_service._ocp.ocp_sessions[sess.session_id].player_state, PlayerState.STOPPED) messages = [] utt = Message("ovos.common_play.status.response", @@ -221,11 +221,11 @@ def on_get(m): }) self.core.bus.emit(utt) - self.assertEqual(self.core.intent_service.ocp.ocp_sessions[sess.session_id].player_state, + self.assertEqual(self.core.intent_service._ocp.ocp_sessions[sess.session_id].player_state, PlayerState.PLAYING) def test_radio_media_match(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) messages = [] def new_msg(msg): @@ -251,7 +251,7 @@ def wait_for_n_messages(n): "converse", "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=True, player_state=PlayerState.STOPPED, media_state=MediaState.NO_MEDIA) utt = Message("recognizer_loop:utterance", @@ -299,7 +299,7 @@ def wait_for_n_messages(n): self.assertEqual(play.data["media"]["uri"], "https://fake_4.mp3") def test_unk_media_match(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) messages = [] def new_msg(msg): @@ -325,7 +325,7 @@ def wait_for_n_messages(n): "converse", "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=True, player_state=PlayerState.STOPPED, media_state=MediaState.NO_MEDIA) utt = Message("recognizer_loop:utterance", @@ -365,7 +365,7 @@ def wait_for_n_messages(n): self.assertEqual(m.msg_type, expected_messages[idx]) def test_skill_name_match(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) messages = [] def new_msg(msg): @@ -391,7 +391,7 @@ def wait_for_n_messages(n): "converse", "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=True, player_state=PlayerState.STOPPED, media_state=MediaState.NO_MEDIA) utt = Message("recognizer_loop:utterance", @@ -436,8 +436,8 @@ def wait_for_n_messages(n): self.assertEqual(m.msg_type, expected_messages[idx]) def test_legacy_match(self): - self.assertIsNotNone(self.core.intent_service.ocp) - self.core.intent_service.ocp.config = {"legacy": True} + self.assertIsNotNone(self.core.intent_service._ocp) + self.core.intent_service._ocp.config = {"legacy": True} messages = [] @@ -465,7 +465,7 @@ def wait_for_n_messages(n): "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=False, player_state=PlayerState.STOPPED, media_state=MediaState.NO_MEDIA) @@ -510,13 +510,13 @@ def wait_for_n_messages(n): for idx, m in enumerate(messages): self.assertEqual(m.msg_type, expected_messages[idx]) - ocp = self.core.intent_service.ocp.ocp_sessions[sess.session_id] + ocp = self.core.intent_service._ocp.ocp_sessions[sess.session_id] self.assertEqual(ocp.player_state, PlayerState.PLAYING) self.assertEqual(ocp.media_state, MediaState.LOADING_MEDIA) def test_legacy_pause(self): - self.assertIsNotNone(self.core.intent_service.ocp) - self.core.intent_service.ocp.config = {"legacy": True} + self.assertIsNotNone(self.core.intent_service._ocp) + self.core.intent_service._ocp.config = {"legacy": True} messages = [] def new_msg(msg): @@ -542,7 +542,7 @@ def wait_for_n_messages(n): "converse", "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=False, player_state=PlayerState.PLAYING, media_state=MediaState.LOADED_MEDIA) @@ -568,12 +568,12 @@ def wait_for_n_messages(n): for idx, m in enumerate(messages): self.assertEqual(m.msg_type, expected_messages[idx]) - ocp = self.core.intent_service.ocp.ocp_sessions[sess.session_id] + ocp = self.core.intent_service._ocp.ocp_sessions[sess.session_id] self.assertEqual(ocp.player_state, PlayerState.PAUSED) def test_legacy_resume(self): - self.assertIsNotNone(self.core.intent_service.ocp) - self.core.intent_service.ocp.config = {"legacy": True} + self.assertIsNotNone(self.core.intent_service._ocp) + self.core.intent_service._ocp.config = {"legacy": True} messages = [] @@ -601,7 +601,7 @@ def wait_for_n_messages(n): "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=False, player_state=PlayerState.PAUSED, media_state=MediaState.LOADED_MEDIA) utt = Message("recognizer_loop:utterance", @@ -626,12 +626,12 @@ def wait_for_n_messages(n): for idx, m in enumerate(messages): self.assertEqual(m.msg_type, expected_messages[idx]) - ocp = self.core.intent_service.ocp.ocp_sessions[sess.session_id] + ocp = self.core.intent_service._ocp.ocp_sessions[sess.session_id] self.assertEqual(ocp.player_state, PlayerState.PLAYING) def test_legacy_stop(self): - self.assertIsNotNone(self.core.intent_service.ocp) - self.core.intent_service.ocp.config = {"legacy": True} + self.assertIsNotNone(self.core.intent_service._ocp) + self.core.intent_service._ocp.config = {"legacy": True} messages = [] def new_msg(msg): @@ -658,7 +658,7 @@ def wait_for_n_messages(n): "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=False, player_state=PlayerState.PLAYING, media_state=MediaState.LOADED_MEDIA) @@ -684,12 +684,12 @@ def wait_for_n_messages(n): for idx, m in enumerate(messages): self.assertEqual(m.msg_type, expected_messages[idx]) - ocp = self.core.intent_service.ocp.ocp_sessions[sess.session_id] + ocp = self.core.intent_service._ocp.ocp_sessions[sess.session_id] self.assertEqual(ocp.player_state, PlayerState.STOPPED) def test_legacy_next(self): - self.assertIsNotNone(self.core.intent_service.ocp) - self.core.intent_service.ocp.config = {"legacy": True} + self.assertIsNotNone(self.core.intent_service._ocp) + self.core.intent_service._ocp.config = {"legacy": True} messages = [] def new_msg(msg): @@ -716,7 +716,7 @@ def wait_for_n_messages(n): "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=False, player_state=PlayerState.PLAYING, media_state=MediaState.LOADED_MEDIA) @@ -743,8 +743,8 @@ def wait_for_n_messages(n): self.assertEqual(m.msg_type, expected_messages[idx]) def test_legacy_prev(self): - self.assertIsNotNone(self.core.intent_service.ocp) - self.core.intent_service.ocp.config = {"legacy": True} + self.assertIsNotNone(self.core.intent_service._ocp) + self.core.intent_service._ocp.config = {"legacy": True} messages = [] def new_msg(msg): @@ -770,7 +770,7 @@ def wait_for_n_messages(n): "converse", "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=False, player_state=PlayerState.PLAYING, media_state=MediaState.LOADED_MEDIA) utt = Message("recognizer_loop:utterance", @@ -796,7 +796,7 @@ def wait_for_n_messages(n): self.assertEqual(m.msg_type, expected_messages[idx]) def test_pause(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) messages = [] def new_msg(msg): @@ -822,7 +822,7 @@ def wait_for_n_messages(n): "converse", "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=True, player_state=PlayerState.PLAYING, media_state=MediaState.LOADED_MEDIA) utt = Message("recognizer_loop:utterance", @@ -848,7 +848,7 @@ def wait_for_n_messages(n): self.assertEqual(m.msg_type, expected_messages[idx]) def test_resume(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) messages = [] def new_msg(msg): @@ -875,7 +875,7 @@ def wait_for_n_messages(n): "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=True, player_state=PlayerState.PAUSED, media_state=MediaState.LOADED_MEDIA) utt = Message("recognizer_loop:utterance", @@ -901,7 +901,7 @@ def wait_for_n_messages(n): self.assertEqual(m.msg_type, expected_messages[idx]) def test_stop(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) messages = [] def new_msg(msg): @@ -927,7 +927,7 @@ def wait_for_n_messages(n): "converse", "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=True, player_state=PlayerState.PLAYING, media_state=MediaState.LOADED_MEDIA) utt = Message("recognizer_loop:utterance", @@ -954,7 +954,7 @@ def wait_for_n_messages(n): self.assertEqual(m.msg_type, expected_messages[idx]) def test_next(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) messages = [] def new_msg(msg): @@ -980,7 +980,7 @@ def wait_for_n_messages(n): "converse", "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=True, player_state=PlayerState.PLAYING, media_state=MediaState.LOADED_MEDIA) utt = Message("recognizer_loop:utterance", @@ -1006,7 +1006,7 @@ def wait_for_n_messages(n): self.assertEqual(m.msg_type, expected_messages[idx]) def test_prev(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) messages = [] def new_msg(msg): @@ -1032,7 +1032,7 @@ def wait_for_n_messages(n): "converse", "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=True, player_state=PlayerState.PLAYING, media_state=MediaState.LOADED_MEDIA) utt = Message("recognizer_loop:utterance", @@ -1058,7 +1058,7 @@ def wait_for_n_messages(n): self.assertEqual(m.msg_type, expected_messages[idx]) def test_status_matches_not_playing(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) def new_msg(msg): nonlocal messages @@ -1084,7 +1084,7 @@ def wait_for_n_messages(n): "ocp_high" ]) - self.core.intent_service.ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( + self.core.intent_service._ocp.ocp_sessions[sess.session_id] = OCPPlayerProxy( session_id=sess.session_id, available_extractors=[], ocp_available=True, player_state=PlayerState.STOPPED, media_state=MediaState.NO_MEDIA) @@ -1114,9 +1114,9 @@ def wait_for_n_messages(n): self.assertEqual(m.msg_type, expected_messages[idx]) def test_legacy_cps(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) - self.core.intent_service.ocp.config = {"legacy_cps": True} + self.core.intent_service._ocp.config = {"legacy_cps": True} messages = [] @@ -1171,13 +1171,13 @@ class TestLegacyCPSPipeline(TestCase): def setUp(self): self.skill_id = "skill-fake-fm-legacy.openvoiceos" self.core = get_minicroft(self.skill_id) - self.core.intent_service.ocp.config = {"legacy_cps": True} + self.core.intent_service._ocp.config = {"legacy_cps": True} def tearDown(self) -> None: self.core.stop() def test_legacy_cps(self): - self.assertIsNotNone(self.core.intent_service.ocp) + self.assertIsNotNone(self.core.intent_service._ocp) messages = []