aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordu erpei <duep.fnst@fujitsu.com>2021-08-20 16:45:32 +0800
committerJan-Simon Möller <jsmoeller@linuxfoundation.org>2021-11-03 15:11:21 +0100
commitfa03a0ba9b7f21b6135753a619749c4bf84b4cda (patch)
tree45a22b376839fd044c1e4ed85511f36adebc83e7
parenta563777f941cec6c69c221e05a6aebc3e6b2a663 (diff)
Add testcases to agl-service-homescreen module.
Bug-AGL: SPEC-4055 Signed-off-by: du erpei <duep.fnst@fujitsu.com> Change-Id: I6404c54260aec058de4f37370b1a160e1861a09e
-rw-r--r--pyagl/services/homescreen.py22
-rw-r--r--pyagl/tests/test_homescreen.py43
2 files changed, 60 insertions, 5 deletions
diff --git a/pyagl/services/homescreen.py b/pyagl/services/homescreen.py
index d364ec7..c62e3ab 100644
--- a/pyagl/services/homescreen.py
+++ b/pyagl/services/homescreen.py
@@ -31,7 +31,7 @@ class HomeScreenService(AGLBaseService):
super().__init__(api='homescreen', ip=ip, port=port, service='agl-service-homescreen')
async def tap_shortcut(self, app: str):
- return await self.request('tap_shortcut', {'appid': app})
+ return await self.request('tap_shortcut', {'application_id': app})
async def subscribe(self, event):
return await super().subscribe(event='event')
@@ -39,6 +39,26 @@ class HomeScreenService(AGLBaseService):
async def unsubscribe(self, event):
return await super().unsubscribe(event='event')
+ async def showWindow(self, app: str):
+ return await self.request('showWindow', {'application_id': app})
+
+ async def hideWindow(self, app: str):
+ return await self.request('hideWindow', {'application_id': app})
+
+ async def ping(self):
+ return await self.request('ping')
+
+ async def replyShowWindow(self, app: str):
+ return await self.request('replyShowWindow', {'application_id': app})
+
+ async def on_screen_message(self):
+ return await self.request('on_screen_message')
+
+ async def on_screen_reply(self):
+ return await self.request('on_screen_reply')
+
+ async def getRunnables(self):
+ return await self.request('getRunnables')
async def main(loop):
args = HomeScreenService.parser.parse_args()
diff --git a/pyagl/tests/test_homescreen.py b/pyagl/tests/test_homescreen.py
index 80a7b6c..c30d311 100644
--- a/pyagl/tests/test_homescreen.py
+++ b/pyagl/tests/test_homescreen.py
@@ -40,10 +40,10 @@ async def service():
await svc.websocket.close()
-# async def test_tap_shortcut_media(event_loop, service: hcs):
-# msgid = await service.tap_shortcut('mediaplayer')
-# resp = await service.afbresponse()
-# assert resp.status == 'success'
+async def test_tap_shortcut_media(event_loop, service: hcs):
+ msgid = await service.tap_shortcut('mediaplayer')
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
async def test_subscribe(event_loop, service: hcs):
msgid = await service.subscribe(event='tap_shortcut')
@@ -54,3 +54,38 @@ async def test_unsubscribe(event_loop, service: hcs):
msgid = await service.unsubscribe(event='tap_shortcut')
resp = await service.afbresponse()
assert resp.msgid == msgid
+
+async def test_showWindow(event_loop, service: hcs):
+ msgid = await service.showWindow('mediaplayer')
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+
+async def test_hideWindow(event_loop, service: hcs):
+ misgid = await service.hideWindow('mediaplayer')
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+
+async def test_ping(event_loop, service: hcs):
+ misgid = await service.ping()
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+
+async def test_replyShowWindow(event_loop, service: hcs):
+ misgid = await service.replyShowWindow('mediaplayer')
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+
+async def test_on_screen_message(event_loop, service: hcs):
+ misgid = await service.on_screen_message()
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+
+async def test_on_screen_reply(event_loop, service: hcs):
+ misgid = await service.on_screen_reply()
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+
+async def test_getRunnables(event_loop, service: hcs):
+ misgid = await service.getRunnables()
+ resp = await service.afbresponse()
+ assert resp.status == 'success'