STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_directory Namespace Reference

Classes

class  _Req

Functions

 _isolate (tmp_path, monkeypatch)
 _fake_auth (monkeypatch, rows, *, calls=None)
 test_volume_users_alone_when_auth_is_unset ()
 test_union_prefers_auths_spelling_and_name (monkeypatch)
 test_auth_users_who_never_opened_this_app_are_still_shareable (monkeypatch)
 test_forwards_only_the_session_cookie (monkeypatch)
 test_auth_failure_degrades_to_the_volume (monkeypatch, boom)
 test_malformed_auth_response_is_ignored (monkeypatch, garbage)
 test_roster_is_cached (monkeypatch)
 test_display_names_maps_slugs (monkeypatch)
 test_a_fresh_process_asks_auth_even_on_a_just_booted_machine (monkeypatch)

Variables

 reason

Detailed Description

The share picker's roster (backend/directory.py).

Sharing needs a list of people, and this app has never had one. The roster is
the union of the auth service's login records and whoever already has data on
the shared volume -- it needs both, because auth only learns about someone when
they log in (30-day sessions, so the roster starts nearly empty) and dev runs
with no auth service at all.

The invariant that matters: auth being unset, down, slow, or lying must never
break listing or sharing designs.

Function Documentation

◆ _fake_auth()

◆ _isolate()

test_directory._isolate ( tmp_path,
monkeypatch )
protected

Definition at line 35 of file test_directory.py.

◆ test_a_fresh_process_asks_auth_even_on_a_just_booted_machine()

test_directory.test_a_fresh_process_asks_auth_even_on_a_just_booted_machine ( monkeypatch)
The cache must not mistake "never fetched" for "fetched just now".

`time.monotonic()` counts from boot, so a sentinel timestamp of 0.0 reads as
stale on a machine that has been up for hours and as *fresh* on one that has
not. That shipped: for the first TTL after every restart the roster came back
empty, from a cache that had never been filled, without auth being asked.
Local runs never caught it -- a fresh CI container did.

Definition at line 146 of file test_directory.py.

References _fake_auth().

◆ test_auth_failure_degrades_to_the_volume()

test_directory.test_auth_failure_degrades_to_the_volume ( monkeypatch,
boom )

Definition at line 115 of file test_directory.py.

◆ test_auth_users_who_never_opened_this_app_are_still_shareable()

test_directory.test_auth_users_who_never_opened_this_app_are_still_shareable ( monkeypatch)

Definition at line 88 of file test_directory.py.

References _fake_auth().

◆ test_display_names_maps_slugs()

test_directory.test_display_names_maps_slugs ( monkeypatch)

Definition at line 141 of file test_directory.py.

References _fake_auth().

◆ test_forwards_only_the_session_cookie()

test_directory.test_forwards_only_the_session_cookie ( monkeypatch)
This app becomes an authenticated-request forwarder. It must present the
caller's own cookie and nothing else, to a URL it took from the environment
rather than the request.

Definition at line 93 of file test_directory.py.

References _fake_auth().

◆ test_malformed_auth_response_is_ignored()

test_directory.test_malformed_auth_response_is_ignored ( monkeypatch,
garbage )

Definition at line 127 of file test_directory.py.

References _fake_auth().

◆ test_roster_is_cached()

test_directory.test_roster_is_cached ( monkeypatch)

Definition at line 133 of file test_directory.py.

References _fake_auth().

◆ test_union_prefers_auths_spelling_and_name()

test_directory.test_union_prefers_auths_spelling_and_name ( monkeypatch)
The volume only ever holds the slug; auth knows the real address and the
display name, and the same person must not appear twice.

Definition at line 74 of file test_directory.py.

References _fake_auth().

◆ test_volume_users_alone_when_auth_is_unset()

test_directory.test_volume_users_alone_when_auth_is_unset ( )
Dev, and the first weeks in prod: no auth roster, but the picker still
has to be usable.

Definition at line 63 of file test_directory.py.

Variable Documentation

◆ reason

test_directory.reason

Definition at line 22 of file test_directory.py.