Skip to content

Commit

Permalink
umu_test_plugins: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
R1kaB3rN committed Nov 24, 2024
1 parent 7e623da commit 3010758
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions umu/umu_test_plugins.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import argparse
import json
import os
import re
import sys
Expand Down Expand Up @@ -66,34 +65,14 @@ def setUp(self):
self.test_user_share = Path("./tmp.jl3W4MtO57")
# ~/.local/share/Steam/compatibilitytools.d
self.test_local_share = Path("./tmp.WUaQAk7hQJ")

# Dictionary that represents the umu_versionS.json
self.root_config = {
"umu": {
"versions": {
"launcher": "0.1-RC3",
"runner": "0.1-RC3",
"runtime_platform": "sniper",
}
}
}
# umu_version.json
self.test_config = json.dumps(self.root_config, indent=4)
self.test_runtime_version = ("sniper", "steamrt3")

self.test_user_share.mkdir(exist_ok=True)
self.test_local_share.mkdir(exist_ok=True)
self.test_cache.mkdir(exist_ok=True)
self.test_compat.mkdir(exist_ok=True)
self.test_proton_dir.mkdir(exist_ok=True)

# Mock a valid configuration file at /usr/share/umu:
# tmp.BXk2NnvW2m/umu_version.json
Path(self.test_user_share, "umu_version.json").touch()
with Path(self.test_user_share, "umu_version.json").open(
mode="w", encoding="utf-8"
) as file:
file.write(self.test_config)

# Mock the launcher files
Path(self.test_user_share, "umu_consts.py").touch()
Path(self.test_user_share, "umu_proton.py").touch()
Expand Down Expand Up @@ -222,8 +201,12 @@ def test_build_command_entry(self):
with (
patch.object(umu_runtime, "_install_umu", return_value=None),
):
# TODO
umu_runtime.setup_umu(
self.test_user_share, self.test_local_share, None
self.test_user_share,
self.test_local_share,
self.test_runtime_version,
None,
)
copytree(
Path(self.test_user_share, "sniper_platform_0.20240125.75305"),
Expand Down Expand Up @@ -298,7 +281,10 @@ def test_build_command_proton(self):
patch.object(umu_runtime, "_install_umu", return_value=None),
):
umu_runtime.setup_umu(
self.test_user_share, self.test_local_share, None
self.test_user_share,
self.test_local_share,
self.test_runtime_version,
None,
)
copytree(
Path(self.test_user_share, "sniper_platform_0.20240125.75305"),
Expand Down Expand Up @@ -380,7 +366,10 @@ def test_build_command_toml(self):
patch.object(umu_runtime, "_install_umu", return_value=None),
):
umu_runtime.setup_umu(
self.test_user_share, self.test_local_share, None
self.test_user_share,
self.test_local_share,
self.test_runtime_version,
None,
)
copytree(
Path(self.test_user_share, "sniper_platform_0.20240125.75305"),
Expand Down

0 comments on commit 3010758

Please sign in to comment.