summaryrefslogtreecommitdiff
path: root/tests/test_steam_service.py
diff options
context:
space:
mode:
authorKurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>2026-09-12 21:29:08 -0400
committerGitHub <noreply@github.com>2026-09-12 21:29:08 -0400
commite580c6bd60c92af36f92d4c29b5d9a44f73d47d7 (patch)
tree7fc6799626519e5b01fb137f5440c99fda5faca7 /tests/test_steam_service.py
parente997a3fb74fa70f5e60b60807fb0897120e98313 (diff)
parent81feb03288166755545401b9df2ff2c9bc3ae7d7 (diff)
downloaddecky-lsfg-vk-e580c6bd60c92af36f92d4c29b5d9a44f73d47d7.tar.gz
decky-lsfg-vk-e580c6bd60c92af36f92d4c29b5d9a44f73d47d7.zip
Merge pull request #264 from xXJSONDeruloXx/chore/migrate
the big one
Diffstat (limited to 'tests/test_steam_service.py')
-rw-r--r--tests/test_steam_service.py76
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/test_steam_service.py b/tests/test_steam_service.py
new file mode 100644
index 0000000..75cdabf
--- /dev/null
+++ b/tests/test_steam_service.py
@@ -0,0 +1,76 @@
+import sys
+import types
+import unittest
+from pathlib import Path
+from unittest.mock import Mock
+
+
+sys.modules.setdefault(
+ "decky",
+ types.SimpleNamespace(DECKY_USER_HOME="/home/deck", logger=Mock()),
+)
+sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "py_modules"))
+
+from lsfg_vk.steam_service import SteamService
+
+
+class SteamShortcutTests(unittest.TestCase):
+ def test_direct_flatpak_shortcut_is_marked(self):
+ game = SteamService._shortcut_game(
+ {
+ "appid": 123456,
+ "AppName": "PCSX2 shortcut",
+ "Exe": "/usr/bin/flatpak",
+ "LaunchOptions": "run net.pcsx2.PCSX2 --fullscreen",
+ "StartDir": "/home/deck/Games",
+ }
+ )
+
+ self.assertEqual(game, {
+ "appid": "123456",
+ "name": "PCSX2 shortcut",
+ "nonSteam": True,
+ "isFlatpakShortcut": True,
+ })
+
+ def test_bare_flatpak_shortcut_is_marked(self):
+ game = SteamService._shortcut_game(
+ {
+ "appid": 654321,
+ "AppName": "Faugus shortcut",
+ "Exe": '"flatpak"',
+ "LaunchOptions": "run io.github.Faugus.faugus-launcher --game elliot",
+ }
+ )
+
+ self.assertEqual(game, {
+ "appid": "654321",
+ "name": "Faugus shortcut",
+ "nonSteam": True,
+ "isFlatpakShortcut": True,
+ })
+
+ def test_emudeck_launcher_is_ordinary_non_steam_metadata(self):
+ game = SteamService._shortcut_game(
+ {
+ "appid": 987654,
+ "AppName": "1080 Snowboarding",
+ "Exe": '"/home/deck/Emulation/tools/launchers/retroarch.sh" -L core rom.z64',
+ "LaunchOptions": "",
+ }
+ )
+
+ self.assertEqual(game, {
+ "appid": "987654",
+ "name": "1080 Snowboarding",
+ "nonSteam": True,
+ })
+
+ def test_shortcut_rejects_invalid_identity(self):
+ self.assertIsNone(SteamService._shortcut_game({"appid": 0, "AppName": "Bad"}))
+ self.assertIsNone(SteamService._shortcut_game({"appid": 1, "AppName": ""}))
+ self.assertIsNone(SteamService._shortcut_game("bad"))
+
+
+if __name__ == "__main__":
+ unittest.main()