diff --git a/requirements/dev.txt b/requirements/dev.txt index 85c5f4e..93f4b0a 100755 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,6 +1,6 @@ -r app.txt invoke==1.2.0 -pytest==4.2.0 +pytest==5.2.0 pytest-asyncio==0.10.0 pytest-mock==1.10.3 pytest-flakes==4.0.0 diff --git a/src/plugin.py b/src/plugin.py index 28abc62..966b0f1 100755 --- a/src/plugin.py +++ b/src/plugin.py @@ -326,28 +326,26 @@ async def get_friends(self): for user_id, user_name in (await self._backend_client.get_friends(self._user_id)).items() ] - @staticmethod - async def _open_uri(uri): - loop = asyncio.get_running_loop() - await loop.run_in_executor(None, partial(webbrowser.open, uri)) - async def launch_game(self, game_id): if is_uri_handler_installed("origin2"): - await OriginPlugin._open_uri("origin2://game/launch?offerIds={}&autoDownload=true".format(game_id)) + webbrowser.open("origin2://game/launch?offerIds={}&autoDownload=true".format(game_id)) else: - await OriginPlugin._open_uri("https://www.origin.com/download") + webbrowser.open("https://www.origin.com/download") async def install_game(self, game_id): if is_uri_handler_installed("origin2"): - await OriginPlugin._open_uri("origin2://game/download?offerId={}".format(game_id)) + webbrowser.open("origin2://game/download?offerId={}".format(game_id)) else: - await OriginPlugin._open_uri("https://www.origin.com/download") + webbrowser.open("https://www.origin.com/download") if is_windows(): async def uninstall_game(self, game_id): loop = asyncio.get_running_loop() await loop.run_in_executor(None, partial(subprocess.run, ["control", "appwiz.cpl"])) + async def shutdown_platform_client(self) -> None: + webbrowser.open("origin://quit") + def _store_cookies(self, cookies): credentials = { "cookies": cookies diff --git a/src/version.py b/src/version.py index ebdb722..9f3abcc 100755 --- a/src/version.py +++ b/src/version.py @@ -1 +1 @@ -__version__ = "0.28" +__version__ = "0.29" diff --git a/tests/integration_test.py b/tests/integration_test.py index 3250d48..037b882 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -51,30 +51,22 @@ def test_integration(): "jsonrpc": "2.0", "result": { "platform_name": "origin", - "token": token + "token": token, + "features": { + "ImportOwnedGames", + "ImportAchievements", + "ImportInstalledGames", + "LaunchGame", + "InstallGame", + "ShutdownPlatformClient", + "ImportFriends", + "ImportGameTime", + } } } if platform.system().lower() == "windows": - expected_response["result"]["features"] = { - "ImportOwnedGames", - "ImportAchievements", - "ImportInstalledGames", - "LaunchGame", - "InstallGame", - "UninstallGame", - "ImportFriends", - "ImportGameTime" - } - else: - expected_response["result"]["features"] = { - "ImportOwnedGames", - "ImportAchievements", - "ImportInstalledGames", - "LaunchGame", - "InstallGame", - "ImportFriends", - "ImportGameTime" - } + expected_response["result"]["features"].add("UninstallGame") + assert response == expected_response, "Response differs from expected" plugin_socket.close()