Skip to content

Commit

Permalink
added file path checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ZohebShaikh committed Dec 11, 2024
1 parent 3f14d5b commit 467a217
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/unit_tests/service/test_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

from blueapi.config import OIDCConfig
from blueapi.service import main
from blueapi.service.authentication import (
SessionCacheManager,
SessionManager,
)
from blueapi.service.authentication import SessionCacheManager, SessionManager


@pytest.fixture
Expand Down Expand Up @@ -132,3 +129,12 @@ def test_processes_valid_token(
):
inner = main.verify_access_token(oidc_config)
inner(access_token=valid_token_with_jwt["access_token"])


def test_session_cache_manager_returns_writable_file_path(tmp_path):
with patch("os.environ.get") as xdg_directory:
xdg_directory.return_value = tmp_path
cache = SessionCacheManager(token_path=None)
with open(cache._file_path, "xb") as token_file:
assert token_file.writable()
assert cache._file_path == f"{tmp_path}/blueapi_cache"

0 comments on commit 467a217

Please sign in to comment.