summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwangqi <wangq.fnst@cn.fujitsu.com>2021-08-19 09:24:09 +0800
committerJan-Simon Möller <jsmoeller@linuxfoundation.org>2021-11-03 15:11:21 +0100
commit31dd870fd8706512cfb21dffab3d0557702cb877 (patch)
tree7782801733d4cec93cf0a2638b12c7690885f19c
parent4d8a2dc2672b6ad7dc0acb24d7a2554220da44cf (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'