mirror of
https://github.com/aclist/dztui.git
synced 2026-11-16 23:01:53 +01:00
chore: update tests
This commit is contained in:
1 parent
d694aa56e8
commit
da474e274f
1 file changed
+43
@@ -0,0 +1,43 @@
|
||||
import pytest
|
||||
import tempfile
|
||||
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dzgui.api.steam import get_steam_paths
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
|
||||
|
||||
def test_custom_xdg_path(monkeypatch: "MonkeyPatch") -> None:
|
||||
tmp = tempfile.TemporaryDirectory(delete=False).name
|
||||
custom_path = Path(tmp).joinpath("xdg_data_home")
|
||||
monkeypatch.setenv("XDG_DATA_HOME", str(custom_path))
|
||||
|
||||
vdf_path = custom_path.joinpath("Steam/steamapps")
|
||||
vdf_path.mkdir(parents=True, exist_ok=True)
|
||||
vdf_path.joinpath("libraryfolders.vdf").touch()
|
||||
|
||||
resolved_paths = get_steam_paths()
|
||||
expect = custom_path.joinpath("Steam")
|
||||
assert any(expect in el for el in resolved_paths)
|
||||
|
||||
|
||||
def test_default_xdg_path() -> None:
|
||||
resolved_paths = get_steam_paths()
|
||||
expect = Path.home().joinpath(".local/share/Steam")
|
||||
assert any(expect in el for el in resolved_paths)
|
||||
|
||||
|
||||
def test_ubuntu_path() -> None:
|
||||
resolved_paths = get_steam_paths()
|
||||
expect = Path.home().joinpath(".steam/steam")
|
||||
assert any(expect in el for el in resolved_paths)
|
||||
|
||||
|
||||
@pytest.mark.flatpak
|
||||
def test_flatpak_path() -> None:
|
||||
resolved_paths = get_steam_paths()
|
||||
expect = Path.home().joinpath(".var/app/com.valvesoftware.Steam/data/steam")
|
||||
assert any(expect in el for el in resolved_paths)
|
||||
Reference in new issue
Block a user