diff options
-rw-r--r-- | pyagl/services/homescreen.py | 22 | ||||
-rw-r--r-- | pyagl/tests/test_homescreen.py | 43 |
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' |