mirror of
https://github.com/gogcom/galaxy-integrations-python-api.git
synced 2026-04-17 12:46:53 -04:00
SDK-2997: Add launch_platform_client method
This commit is contained in:
@@ -99,6 +99,7 @@ class Feature(Enum):
|
||||
VerifyGame = "VerifyGame"
|
||||
ImportFriends = "ImportFriends"
|
||||
ShutdownPlatformClient = "ShutdownPlatformClient"
|
||||
LaunchPlatformClient = "LaunchPlatformClient"
|
||||
|
||||
|
||||
class LicenseType(Enum):
|
||||
|
||||
@@ -107,6 +107,9 @@ class Plugin:
|
||||
self._register_notification("shutdown_platform_client", self.shutdown_platform_client)
|
||||
self._detect_feature(Feature.ShutdownPlatformClient, ["shutdown_platform_client"])
|
||||
|
||||
self._register_notification("launch_platform_client", self.launch_platform_client)
|
||||
self._detect_feature(Feature.LaunchPlatformClient, ["launch_platform_client"])
|
||||
|
||||
self._register_method("import_friends", self.get_friends, result_name="friend_info_list")
|
||||
self._detect_feature(Feature.ImportFriends, ["get_friends"])
|
||||
|
||||
@@ -657,6 +660,11 @@ class Plugin:
|
||||
This method is called by the GOG Galaxy Client."""
|
||||
raise NotImplementedError()
|
||||
|
||||
async def launch_platform_client(self) -> None:
|
||||
"""Override this method to launch 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.
|
||||
|
||||
@@ -40,6 +40,7 @@ def plugin(reader, writer):
|
||||
"achievements_import_complete",
|
||||
"get_local_games",
|
||||
"launch_game",
|
||||
"launch_platform_client",
|
||||
"install_game",
|
||||
"uninstall_game",
|
||||
"get_friends",
|
||||
|
||||
@@ -13,7 +13,8 @@ def test_base_class():
|
||||
Feature.ImportAchievements,
|
||||
Feature.ImportGameTime,
|
||||
Feature.ImportFriends,
|
||||
Feature.ShutdownPlatformClient
|
||||
Feature.ShutdownPlatformClient,
|
||||
Feature.LaunchPlatformClient
|
||||
}
|
||||
|
||||
|
||||
|
||||
17
tests/test_launch_platform_client.py
Normal file
17
tests/test_launch_platform_client.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import pytest
|
||||
|
||||
from galaxy.unittest.mock import async_return_value
|
||||
|
||||
from tests import create_message
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_success(plugin, read):
|
||||
request = {
|
||||
"jsonrpc": "2.0",
|
||||
"method": "launch_platform_client"
|
||||
}
|
||||
|
||||
read.side_effect = [async_return_value(create_message(request)), async_return_value(b"")]
|
||||
plugin.launch_platform_client.return_value = async_return_value(None)
|
||||
await plugin.run()
|
||||
plugin.launch_platform_client.assert_called_with()
|
||||
Reference in New Issue
Block a user