mirror of
https://github.com/gogcom/galaxy-integrations-python-api.git
synced 2026-01-01 19:38:21 -05:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10ecef791f | ||
|
|
ce193f39bc |
2
setup.py
2
setup.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="galaxy.plugin.api",
|
name="galaxy.plugin.api",
|
||||||
version="0.41",
|
version="0.42",
|
||||||
description="GOG Galaxy Integrations Python API",
|
description="GOG Galaxy Integrations Python API",
|
||||||
author='Galaxy team',
|
author='Galaxy team',
|
||||||
author_email='galaxy@gog.com',
|
author_email='galaxy@gog.com',
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ class Feature(Enum):
|
|||||||
ImportUsers = "ImportUsers"
|
ImportUsers = "ImportUsers"
|
||||||
VerifyGame = "VerifyGame"
|
VerifyGame = "VerifyGame"
|
||||||
ImportFriends = "ImportFriends"
|
ImportFriends = "ImportFriends"
|
||||||
|
ShutdownPlatformClient = "ShutdownPlatformClient"
|
||||||
|
|
||||||
|
|
||||||
class LicenseType(Enum):
|
class LicenseType(Enum):
|
||||||
|
|||||||
@@ -107,6 +107,11 @@ class Plugin:
|
|||||||
self.uninstall_game,
|
self.uninstall_game,
|
||||||
feature=Feature.UninstallGame
|
feature=Feature.UninstallGame
|
||||||
)
|
)
|
||||||
|
self._register_notification(
|
||||||
|
"shutdown_platform_client",
|
||||||
|
self.shutdown_platform_client,
|
||||||
|
feature=Feature.ShutdownPlatformClient
|
||||||
|
)
|
||||||
self._register_method(
|
self._register_method(
|
||||||
"import_friends",
|
"import_friends",
|
||||||
self.get_friends,
|
self.get_friends,
|
||||||
@@ -718,6 +723,11 @@ class Plugin:
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
async def shutdown_platform_client(self) -> None:
|
||||||
|
"""Override this method to gracefully terminate platform client.
|
||||||
|
This method is called by the GOG Galaxy Client."""
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
async def get_friends(self) -> List[FriendInfo]:
|
async def get_friends(self) -> List[FriendInfo]:
|
||||||
"""Override this method to return the friends list
|
"""Override this method to return the friends list
|
||||||
of the currently authenticated user.
|
of the currently authenticated user.
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ def plugin(reader, writer):
|
|||||||
"get_rooms",
|
"get_rooms",
|
||||||
"get_room_history_from_message",
|
"get_room_history_from_message",
|
||||||
"get_room_history_from_timestamp",
|
"get_room_history_from_timestamp",
|
||||||
"get_game_times"
|
"get_game_times",
|
||||||
|
"shutdown_platform_client"
|
||||||
)
|
)
|
||||||
|
|
||||||
methods = (
|
methods = (
|
||||||
|
|||||||
15
tests/test_shutdown_platform_client.py
Normal file
15
tests/test_shutdown_platform_client.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_success(plugin, read):
|
||||||
|
request = {
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"method": "shutdown_platform_client"
|
||||||
|
}
|
||||||
|
|
||||||
|
read.side_effect = [json.dumps(request).encode() + b"\n", b""]
|
||||||
|
plugin.shutdown_platform_client.return_value = None
|
||||||
|
await plugin.run()
|
||||||
|
plugin.shutdown_platform_client.assert_called_with()
|
||||||
Reference in New Issue
Block a user