mirror of
https://github.com/aclist/dztui.git
synced 2026-10-25 12:12:31 +01:00
Merge pull request #495 from aclist/fix/vdf-timestamp
fix: support changes to VDF timestamp
This commit is contained in:
8 files changed
+22
-14
No files matched your search
+2
-2
@@ -245,9 +245,9 @@ def find_user_id(path: Path) -> str | None:
|
|||||||
last_user = str(next(iter(users)))
|
last_user = str(next(iter(users)))
|
||||||
if len(users) == 1:
|
if len(users) == 1:
|
||||||
return last_user
|
return last_user
|
||||||
last_stamp = int(users[last_user]["Timestamp"])
|
last_stamp = int(users[last_user]["timestamp"])
|
||||||
for user in users:
|
for user in users:
|
||||||
stamp = int(users[user]["Timestamp"])
|
stamp = int(users[user]["timestamp"])
|
||||||
if stamp > last_stamp:
|
if stamp > last_stamp:
|
||||||
last_stamp = stamp
|
last_stamp = stamp
|
||||||
last_user = user
|
last_user = user
|
||||||
|
|||||||
+1
-1
@@ -8,6 +8,6 @@
|
|||||||
"WantsOfflineMode" "0"
|
"WantsOfflineMode" "0"
|
||||||
"SkipOfflineModeWarning" "0"
|
"SkipOfflineModeWarning" "0"
|
||||||
"AutoLogin" "1"
|
"AutoLogin" "1"
|
||||||
"Timestamp" "0"
|
"timestamp" "0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -8,7 +8,7 @@
|
|||||||
"WantsOfflineMode" "0"
|
"WantsOfflineMode" "0"
|
||||||
"SkipOfflineModeWarning" "0"
|
"SkipOfflineModeWarning" "0"
|
||||||
"AutoLogin" "1"
|
"AutoLogin" "1"
|
||||||
"Timestamp" "1787904411"
|
"timestamp" "1787904411"
|
||||||
}
|
}
|
||||||
"1"
|
"1"
|
||||||
{
|
{
|
||||||
@@ -18,6 +18,6 @@
|
|||||||
"WantsOfflineMode" "0"
|
"WantsOfflineMode" "0"
|
||||||
"SkipOfflineModeWarning" "0"
|
"SkipOfflineModeWarning" "0"
|
||||||
"AutoLogin" "1"
|
"AutoLogin" "1"
|
||||||
"Timestamp" "1787904647"
|
"timestamp" "1787904647"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
"WantsOfflineMode" "0"
|
"WantsOfflineMode" "0"
|
||||||
"SkipOfflineModeWarning" "0"
|
"SkipOfflineModeWarning" "0"
|
||||||
"AutoLogin" "1"
|
"AutoLogin" "1"
|
||||||
"Timestamp" "1797904411"
|
"timestamp" "1797904411"
|
||||||
}
|
}
|
||||||
"1"
|
"1"
|
||||||
{
|
{
|
||||||
@@ -18,6 +18,6 @@
|
|||||||
"WantsOfflineMode" "0"
|
"WantsOfflineMode" "0"
|
||||||
"SkipOfflineModeWarning" "0"
|
"SkipOfflineModeWarning" "0"
|
||||||
"AutoLogin" "1"
|
"AutoLogin" "1"
|
||||||
"Timestamp" "1787904647"
|
"timestamp" "1787904647"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -9,6 +9,6 @@
|
|||||||
"SkipOfflineModeWarning" "0"
|
"SkipOfflineModeWarning" "0"
|
||||||
"AllowAutoLogin" "1"
|
"AllowAutoLogin" "1"
|
||||||
"MostRecent" "1"
|
"MostRecent" "1"
|
||||||
"Timestamp" "0"
|
"timestamp" "0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"SkipOfflineModeWarning" "0"
|
"SkipOfflineModeWarning" "0"
|
||||||
"AllowAutoLogin" "1"
|
"AllowAutoLogin" "1"
|
||||||
"MostRecent" "0"
|
"MostRecent" "0"
|
||||||
"Timestamp" "0"
|
"timestamp" "0"
|
||||||
}
|
}
|
||||||
"1"
|
"1"
|
||||||
{
|
{
|
||||||
@@ -20,6 +20,6 @@
|
|||||||
"SkipOfflineModeWarning" "0"
|
"SkipOfflineModeWarning" "0"
|
||||||
"AllowAutoLogin" "1"
|
"AllowAutoLogin" "1"
|
||||||
"MostRecent" "1"
|
"MostRecent" "1"
|
||||||
"Timestamp" "10"
|
"timestamp" "10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ gi.require_version("Gtk", "3.0")
|
|||||||
from gi.repository import Gtk, Gio, GLib # noqa
|
from gi.repository import Gtk, Gio, GLib # noqa
|
||||||
|
|
||||||
|
|
||||||
class TestWidget(ColorAwareApp, Gtk.Button):
|
class DummyWidget(ColorAwareApp, Gtk.Button):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
@@ -22,11 +22,10 @@ class TestWidget(ColorAwareApp, Gtk.Button):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def widget() -> TestWidget:
|
def widget() -> DummyWidget:
|
||||||
return TestWidget()
|
return DummyWidget()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.integration
|
|
||||||
@pytest.mark.parametrize("key, expect", [("default", False), ("prefer-dark", True)])
|
@pytest.mark.parametrize("key, expect", [("default", False), ("prefer-dark", True)])
|
||||||
def test_light_mode(widget, key: str, expect: bool) -> None:
|
def test_light_mode(widget, key: str, expect: bool) -> None:
|
||||||
local_pref = subprocess.run(
|
local_pref = subprocess.run(
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import pytest
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from dzgui.api.steam import find_user_id
|
from dzgui.api.steam import find_user_id
|
||||||
|
from dzgui.const.constants import DEFAULT_STEAM_PATH
|
||||||
from tests.fixtures import fixture_path
|
from tests.fixtures import fixture_path
|
||||||
|
|
||||||
pytestmark = pytest.mark.apitest
|
pytestmark = pytest.mark.apitest
|
||||||
@@ -25,3 +26,11 @@ def test_loginusers(monkeypatch, fixture: str, expect: int) -> None:
|
|||||||
monkeypatch.setattr("dzgui.api.steam.find_loginusers", mock_loginusers)
|
monkeypatch.setattr("dzgui.api.steam.find_loginusers", mock_loginusers)
|
||||||
uid = find_user_id(Path(""))
|
uid = find_user_id(Path(""))
|
||||||
assert int(uid) == expect
|
assert int(uid) == expect
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.realconfig
|
||||||
|
def test_live_loginusers() -> None:
|
||||||
|
"""Added on 2026-10-17 following changes to VDF keys"""
|
||||||
|
steam = Path.home().joinpath(DEFAULT_STEAM_PATH)
|
||||||
|
uid = find_user_id(steam)
|
||||||
|
assert uid is not None
|
||||||
Reference in new issue
Block a user