From d78c08ae4bc79657a8ad426256960928c80b0351 Mon Sep 17 00:00:00 2001 From: Rafal Makagon Date: Wed, 13 Feb 2019 10:40:08 +0100 Subject: [PATCH] add authentication lost notification --- galaxy/api/plugin.py | 3 +++ tests/test_authenticate.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/galaxy/api/plugin.py b/galaxy/api/plugin.py index ce09698..14a2152 100644 --- a/galaxy/api/plugin.py +++ b/galaxy/api/plugin.py @@ -242,6 +242,9 @@ class Plugin(): params = {"game_time" : game_time} self._notification_client.notify("game_time_updated", params) + def lost_authentication(self): + self._notification_client.notify("authentication_lost", None) + # handlers def tick(self): """This method is called periodicaly. diff --git a/tests/test_authenticate.py b/tests/test_authenticate.py index c12266d..72ad82a 100644 --- a/tests/test_authenticate.py +++ b/tests/test_authenticate.py @@ -84,3 +84,17 @@ def test_store_credentials(plugin, write): "method": "store_credentials", "params": credentials } + +def test_lost_authentication(plugin, readline, write): + + async def couritine(): + plugin.lost_authentication() + + asyncio.run(couritine()) + response = json.loads(write.call_args[0][0]) + + assert response == { + "jsonrpc": "2.0", + "method": "authentication_lost", + "params": None + }