animedex.auth.inmemory_store

In-memory implementation of TokenStore.

Used in two places: by unit tests (so credential paths are exercisable without OS-level state), and by callers running in a headless CI environment where the real keyring has no backend (plans/02 §7 rules out plain-text disk fallbacks; this in-memory store is the documented escape hatch for ephemeral processes).

InMemoryTokenStore

class animedex.auth.inmemory_store.InMemoryTokenStore(initial: Mapping[str, str] | None = None)[source]

Bases: object

A TokenStore that lives in process memory.

Parameters:

initial (Mapping[str, str] or None) – Optional pre-populated mapping. Useful for tests that want to assert authenticated behaviour without dispatching through the real keyring.

__init__(initial: Mapping[str, str] | None = None) None[source]
set(backend: str, token: str) None[source]
get(backend: str) str | None[source]
delete(backend: str) None[source]
keys() Iterable[str][source]

selftest

animedex.auth.inmemory_store.selftest() bool[source]

Smoke-test the in-memory store.

Round-trips a value, deletes it, confirms the deletion is idempotent, and confirms an absent key reads as None.

Returns:

True on success.

Return type:

bool