aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwangqi <wangq.fnst@cn.fujitsu.com>2021-08-19 09:24:09 +0800
committerEdi Feschiyan <edi.feschiyan@konsulko.com>2021-08-20 11:06:43 +0000
commit1fbb7518d5e295bf10e78b11e4dcea77ffad6267 (patch)
tree9a96482d4e37c3b6f6137cf5b2f8607ce76690d1
parent6ce6f03f6d2bee33e3f72b08f05f9e8b4ddd3f10 (diff)
Adding agl-service-audiomixer tests for un/subscription.
Bug-AGL: SPEC-4053 Signed-off-by: wangqi <wangq.fnst@cn.fujitsu.com> Change-Id: If600c334666cad7e6a15fee88633185aca001d05
-rw-r--r--pyagl/services/audiomixer.py4
-rw-r--r--pyagl/tests/test_audiomixer.py18
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'