mirror of
https://github.com/gogcom/galaxy-integrations-python-api.git
synced 2026-01-01 03:18:25 -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(
|
||||
name="galaxy.plugin.api",
|
||||
version="0.41",
|
||||
version="0.42",
|
||||
description="GOG Galaxy Integrations Python API",
|
||||
author='Galaxy team',
|
||||
author_email='galaxy@gog.com',
|
||||
|
||||
@@ -98,6 +98,7 @@ class Feature(Enum):
|
||||
ImportUsers = "ImportUsers"
|
||||
VerifyGame = "VerifyGame"
|
||||
ImportFriends = "ImportFriends"
|
||||
ShutdownPlatformClient = "ShutdownPlatformClient"
|
||||
|
||||
|
||||
class LicenseType(Enum):
|
||||
|
||||
@@ -107,6 +107,11 @@ class Plugin:
|
||||
self.uninstall_game,
|
||||
feature=Feature.UninstallGame
|
||||
)
|
||||
self._register_notification(
|
||||
"shutdown_platform_client",
|
||||
self.shutdown_platform_client,
|
||||
feature=Feature.ShutdownPlatformClient
|
||||
)
|
||||
self._register_method(
|
||||
"import_friends",
|
||||
self.get_friends,
|
||||
@@ -718,6 +723,11 @@ class Plugin:
|
||||
"""
|
||||
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]:
|
||||
"""Override this method to return the friends list
|
||||
of the currently authenticated user.
|
||||
|
||||
@@ -48,7 +48,8 @@ def plugin(reader, writer):
|
||||
"get_rooms",
|
||||
"get_room_history_from_message",
|
||||
"get_room_history_from_timestamp",
|
||||
"get_game_times"
|
||||
"get_game_times",
|
||||
"shutdown_platform_client"
|
||||
)
|
||||
|
||||
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