fix(desktop): keep profile homes out of bootstrap (#46073)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import PureWindowsPath
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from hermes_cli.telegram_managed_bot import (
|
||||
@@ -321,3 +322,34 @@ class TestSetupTelegramAuto:
|
||||
from hermes_cli.setup import _setup_telegram_auto
|
||||
|
||||
assert callable(_setup_telegram_auto)
|
||||
|
||||
def test_setup_result_passes_profile_name_for_profile_home(self, monkeypatch, tmp_path):
|
||||
from hermes_cli import setup
|
||||
|
||||
seen = {}
|
||||
profile_home = tmp_path / ".hermes" / "profiles" / "oracle"
|
||||
profile_home.mkdir(parents=True)
|
||||
|
||||
monkeypatch.setattr(setup, "get_hermes_home", lambda: profile_home)
|
||||
|
||||
def fake_auto_setup_telegram_bot_result(*, profile_name=None):
|
||||
seen["profile_name"] = profile_name
|
||||
return None
|
||||
|
||||
monkeypatch.setattr(
|
||||
"hermes_cli.telegram_managed_bot.auto_setup_telegram_bot_result",
|
||||
fake_auto_setup_telegram_bot_result,
|
||||
)
|
||||
|
||||
assert setup._setup_telegram_auto_result() is None
|
||||
assert seen["profile_name"] == "oracle"
|
||||
|
||||
def test_profile_name_from_home_path_handles_windows_separators(self):
|
||||
from hermes_cli.setup import _profile_name_from_hermes_home
|
||||
|
||||
assert (
|
||||
_profile_name_from_hermes_home(
|
||||
PureWindowsPath(r"C:\Users\test\AppData\Local\hermes\profiles\oracle")
|
||||
)
|
||||
== "oracle"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user