summaryrefslogtreecommitdiff
path: root/tests/test_steam_service.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_steam_service.py')
-rw-r--r--tests/test_steam_service.py101
1 files changed, 19 insertions, 82 deletions
diff --git a/tests/test_steam_service.py b/tests/test_steam_service.py
index 636c87f..dd78f10 100644
--- a/tests/test_steam_service.py
+++ b/tests/test_steam_service.py
@@ -11,105 +11,42 @@ sys.modules.setdefault(
)
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "py_modules"))
-from lsfg_vk.steam_service import SteamService, classify_shortcut_transport
+from lsfg_vk.steam_service import SteamService
-class SteamTransportTests(unittest.TestCase):
- def test_only_direct_canonical_flatpak_forms_are_classified(self):
- self.assertEqual(
- classify_shortcut_transport(
- "/usr/bin/flatpak",
- "run com.example.PCSX2 --fullscreen",
- ),
- {"kind": "flatpak", "flatpakAppId": "com.example.PCSX2"},
- )
- self.assertEqual(
- classify_shortcut_transport(
- "flatpak",
- "run com.example.PCSX2 --fullscreen",
- ),
- {"kind": "flatpak", "flatpakAppId": "com.example.PCSX2"},
- )
- self.assertEqual(
- classify_shortcut_transport(
- "/usr/bin/flatpak run com.example.PCSX2",
- "--fullscreen",
- ),
- {"kind": "flatpak", "flatpakAppId": "com.example.PCSX2"},
- )
- self.assertEqual(
- classify_shortcut_transport(
- "/usr/bin/bash",
- "~/launch-game.sh --fullscreen",
- ),
- {"kind": "host"},
- )
- self.assertEqual(
- classify_shortcut_transport(
- "/usr/bin/flatpak",
- "--user run com.example.PCSX2",
- ),
- {"kind": "host"},
- )
- self.assertEqual(
- classify_shortcut_transport(
- "/usr/bin/flatpak",
- "run bash ~/launch-game.sh",
- ),
- {"kind": "host"},
- )
- self.assertEqual(
- classify_shortcut_transport(
- "~/.lsfg",
- "run --branch=stable --arch=x86_64 com.example.PCSX2",
- ),
- {"kind": "flatpak", "flatpakAppId": "com.example.PCSX2"},
- )
- self.assertEqual(
- classify_shortcut_transport(
- "/home/deck/.lsfg",
- "run com.example.PCSX2",
- ),
- {"kind": "flatpak", "flatpakAppId": "com.example.PCSX2"},
- )
- self.assertEqual(
- classify_shortcut_transport("~/.lsfg", "--profile high"),
- {"kind": "host"},
- )
-
- def test_shortcut_data_preserves_transport_inputs(self):
+class SteamServiceTests(unittest.TestCase):
+ def test_shortcut_data_is_host_only_and_preserves_launch_fields(self):
game = SteamService._shortcut_game(
{
"appid": 123456,
- "AppName": "PCSX2 shortcut",
- "Exe": "/usr/bin/flatpak",
- "LaunchOptions": "run net.pcsx2.PCSX2 --fullscreen",
+ "AppName": "Native shortcut",
+ "Exe": "/usr/bin/game",
+ "LaunchOptions": "--fullscreen",
"StartDir": "/home/deck/Games",
}
)
- self.assertEqual(game["appid"], "123456")
- self.assertEqual(game["transport"], {
- "kind": "flatpak",
- "flatpakAppId": "net.pcsx2.PCSX2",
+ self.assertEqual(game, {
+ "appid": "123456",
+ "name": "Native shortcut",
+ "nonSteam": True,
+ "executable": "/usr/bin/game",
+ "arguments": "--fullscreen",
+ "startDir": "/home/deck/Games",
})
- self.assertEqual(game["executable"], "/usr/bin/flatpak")
- self.assertEqual(game["arguments"], "run net.pcsx2.PCSX2 --fullscreen")
- self.assertEqual(game["startDir"], "/home/deck/Games")
- def test_wrapped_flatpak_shortcut_remains_a_flatpak_target(self):
+ def test_shortcut_data_accepts_missing_optional_launch_fields(self):
game = SteamService._shortcut_game(
{
"appid": 987654,
- "AppName": "Wrapped Flatpak",
- "Exe": "~/.lsfg",
- "LaunchOptions": "run --branch=stable --arch=x86_64 com.example.Game",
+ "AppName": "Game shortcut",
}
)
- self.assertEqual(game["transport"], {
- "kind": "flatpak",
- "flatpakAppId": "com.example.Game",
+ self.assertEqual(game, {
+ "appid": "987654",
+ "name": "Game shortcut",
+ "nonSteam": True,
})