mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-10 19:07:16 +01:00
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
29 lines
784 B
Python
29 lines
784 B
Python
"""Helpers for the credential-recovery tests.
|
|
|
|
Shared because ``test_credential_recovery.py`` had to be split at the
|
|
250-line cap and both halves build the same on-disk credential caches.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from typing import TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from pathlib import Path
|
|
|
|
|
|
def write_cache(path: Path, refresh_token: str, *, expires_at: str) -> None:
|
|
"""Write a credential cache shaped like ``FileCredentialStore``'s."""
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
path.write_text(
|
|
json.dumps(
|
|
{
|
|
"id_token": "stale-id-token",
|
|
"refresh_token": refresh_token,
|
|
"expires_at": expires_at,
|
|
"local_id": "uid-1",
|
|
}
|
|
)
|
|
)
|