diff --git a/app/cloud_session.py b/app/cloud_session.py index 8aa642b..ee6c583 100644 --- a/app/cloud_session.py +++ b/app/cloud_session.py @@ -208,8 +208,6 @@ def get_session(request: Request) -> CloudUser: if not CLOUD_MODE: return CloudUser(user_id="local", tier="local", db=_LOCAL_KIWI_DB, has_byok=has_byok) - # Prefer X-Real-IP (set by nginx from the actual client address) over the - # TCP peer address (which is nginx's container IP when behind the proxy). # Prefer X-Real-IP (set by nginx from the actual client address) over the # TCP peer address (which is nginx's container IP when behind the proxy). client_ip = ( diff --git a/tests/test_household.py b/tests/test_household.py index 40a3f9a..a6b76ba 100644 --- a/tests/test_household.py +++ b/tests/test_household.py @@ -6,10 +6,10 @@ import pytest os.environ.setdefault("CLOUD_MODE", "false") +import app.cloud_session as cs from app.cloud_session import ( CloudUser, _user_db_path, - CLOUD_DATA_ROOT, ) @@ -28,11 +28,13 @@ def test_clouduser_household_defaults_none(): assert u.is_household_owner is False -def test_user_db_path_personal(): - path = _user_db_path("abc123", household_id=None) - assert path == CLOUD_DATA_ROOT / "abc123" / "kiwi.db" +def test_user_db_path_personal(tmp_path, monkeypatch): + monkeypatch.setattr(cs, "CLOUD_DATA_ROOT", tmp_path) + result = cs._user_db_path("abc123") + assert result == tmp_path / "abc123" / "kiwi.db" -def test_user_db_path_household(): - path = _user_db_path("abc123", household_id="hh-xyz") - assert path == CLOUD_DATA_ROOT / "household_hh-xyz" / "kiwi.db" +def test_user_db_path_household(tmp_path, monkeypatch): + monkeypatch.setattr(cs, "CLOUD_DATA_ROOT", tmp_path) + result = cs._user_db_path("abc123", household_id="hh-xyz") + assert result == tmp_path / "household_hh-xyz" / "kiwi.db"