change: return client name from controller

This commit is contained in:
aclist committed 2026-10-21 12:59:54 +09:00
1 parent 07460a1f8f
commit eed40e6f1a
3 files changed
+25 -2

No files matched your search

+5
View File
@@ -541,6 +541,11 @@ class Controller(GObject.GObject):
def update_status(self) -> None:
self.mediator.preconnect.mark_finished()
def get_client_name(self) -> str:
# NOTE: only possible values are "Steam" and "Flatpak"
cmd = self.query_config(Preferences.CLIENT)
return cmd.split()[0].capitalize()
def present_window(self) -> None:
self.mediator.window.present_with_time(Gdk.CURRENT_TIME)
+1 -2
View File
@@ -185,8 +185,7 @@ class ConnectionManager:
allows_downloads = (True, "")
client = self.controller.query_config(Preferences.CLIENT)
# TODO: add test
client_name = client.split()[0].capitalize()
client_name = self.controller.get_client_name()
running = is_steam_running(client)
steam_proc = SteamProcess(client_name, running)
self.client = client
+19
View File
@@ -0,0 +1,19 @@
import pytest
from dzgui.const.constants import FLATPAK_RUN_CMD, STEAM_CMD
from dzgui.controllers.mc import Controller
@pytest.mark.parametrize(
"value, expected", [(FLATPAK_RUN_CMD, "Flatpak"), (STEAM_CMD, "Steam")]
)
def test_human_name(monkeypatch, value, expected) -> None:
def mock_query_config(*args) -> str:
return value
monkeypatch.setattr(
"dzgui.controllers.mc.Controller.query_config", mock_query_config
)
controller = Controller()
client = controller.get_client_name()
assert client == expected