From 1fbb7518d5e295bf10e78b11e4dcea77ffad6267 Mon Sep 17 00:00:00 2001 From: wangqi Date: Thu, 19 Aug 2021 09:24:09 +0800 Subject: Adding agl-service-audiomixer tests for un/subscription. Bug-AGL: SPEC-4053 Signed-off-by: wangqi Change-Id: If600c334666cad7e6a15fee88633185aca001d05 --- pyagl/services/audiomixer.py | 4 ++-- pyagl/tests/test_audiomixer.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/pyagl/services/audiomixer.py b/pyagl/services/audiomixer.py index fa9a7fd..41db856 100644 --- a/pyagl/services/audiomixer.py +++ b/pyagl/services/audiomixer.py @@ -33,10 +33,10 @@ class AudioMixerService(AGLBaseService): def __init__(self, ip, port=None, service='agl-service-audiomixer'): super().__init__(api='audiomixer', ip=ip, port=port, service=service) - async def subscribe(self, event='volume_changed'): # audio mixer uses 'event' instead 'value', + async def subscribe(self, event=None): # audio mixer uses 'event' instead 'value', return await self.request('subscribe', {'event': event}) - async def unsubscribe(self, event='volume_changed'): + async def unsubscribe(self, event=None): return await self.request('unsubscribe', {'event': event}) async def list_controls(self): diff --git a/pyagl/tests/test_audiomixer.py b/pyagl/tests/test_audiomixer.py index 5f9b7d0..2349486 100644 --- a/pyagl/tests/test_audiomixer.py +++ b/pyagl/tests/test_audiomixer.py @@ -101,3 +101,21 @@ async def test_set_unmute(event_loop, service: AMS): assert msgid == resp.msgid assert resp.type == AFBT.RESPONSE assert resp.status == 'success' + + +@pytest.mark.audiomixer +async def test_subscribe(event_loop,service: AMS): + msgid = await service.subscribe('volume_changed') + resp = await service.afbresponse() + assert msgid == resp.msgid + assert resp.type == AFBT.RESPONSE + assert resp.status == 'success' + + +@pytest.mark.audiomixer +async def test_unsubscribe(event_loop,service: AMS): + msgid = await service.unsubscribe('volume_changed') + resp = await service.afbresponse() + assert msgid == resp.msgid + assert resp.type == AFBT.RESPONSE + assert resp.status == 'success' -- cgit 1.2.3-korg