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

Functions

bytes _without_curves ()
bytes _with_curves ()
 _isolate (tmp_path, monkeypatch)
 client ()
 _state (client, headers)
 test_a_yaml_without_curves_is_refused_and_changes_nothing (client)
 test_a_yaml_from_csv_needs_the_checkout_and_changes_nothing_without_it (client, monkeypatch)
 test_a_yaml_from_csv_that_replaces_the_config_returns_a_new_token (client, monkeypatch)
 test_layer_upload_config_rotates_and_returns_the_token (client, layer)
 test_layer_upload_config_needs_the_checkout (client, layer)
Request _request (str email)
UploadFile _upload (str name, bytes body)
 test_from_csv_runs_its_solve_and_its_swap_off_the_event_loop (monkeypatch)
 test_upload_config_and_simulate_never_swaps_the_session_config (client, monkeypatch)

Variables

 reason
 DEFAULT = yaml.safe_load(session_mod._DEFAULT_CONFIG_PATH.read_text())

Detailed Description

Every route that swaps the session config wholesale does it the way /api/config/upload does.

That is: nothing changes on a refusal, the design checkout is asked, set_config runs off the event
loop, and the session's ``load_token`` is new and handed back. The token is how a second tab of
the same user (one session per user, shared by every tab) notices the design it loaded is gone and
stops autosaving; a swap that kept the old token let that tab write the newcomer over its design.

Found on the LE4 (3) stand's engine YAML (no ``pressure_curves``): POST /api/timeseries/from-csv
answered 400 "does not contain a 'pressure_curves' section" *after* replacing the config, the UI
kept showing the old design, and the design bar autosaved the "failed" upload into it. The Layer 2
and Layer 3 upload-config routes swapped the config with no token and no checkout.

Function Documentation

◆ _isolate()

test_config_wholesale_replacement._isolate ( tmp_path,
monkeypatch )
protected

Definition at line 57 of file test_config_wholesale_replacement.py.

◆ _request()

Request test_config_wholesale_replacement._request ( str email)
protected

◆ _state()

◆ _upload()

UploadFile test_config_wholesale_replacement._upload ( str name,
bytes body )
protected

◆ _with_curves()

◆ _without_curves()

bytes test_config_wholesale_replacement._without_curves ( )
protected

◆ client()

test_config_wholesale_replacement.client ( )

Definition at line 63 of file test_config_wholesale_replacement.py.

◆ test_a_yaml_from_csv_needs_the_checkout_and_changes_nothing_without_it()

test_config_wholesale_replacement.test_a_yaml_from_csv_needs_the_checkout_and_changes_nothing_without_it ( client,
monkeypatch )

Definition at line 87 of file test_config_wholesale_replacement.py.

References _state(), and _with_curves().

◆ test_a_yaml_from_csv_that_replaces_the_config_returns_a_new_token()

test_config_wholesale_replacement.test_a_yaml_from_csv_that_replaces_the_config_returns_a_new_token ( client,
monkeypatch )

Definition at line 106 of file test_config_wholesale_replacement.py.

References _state(), and _with_curves().

◆ test_a_yaml_without_curves_is_refused_and_changes_nothing()

test_config_wholesale_replacement.test_a_yaml_without_curves_is_refused_and_changes_nothing ( client)

Definition at line 72 of file test_config_wholesale_replacement.py.

References _state(), and _without_curves().

◆ test_from_csv_runs_its_solve_and_its_swap_off_the_event_loop()

test_config_wholesale_replacement.test_from_csv_runs_its_solve_and_its_swap_off_the_event_loop ( monkeypatch)

Definition at line 177 of file test_config_wholesale_replacement.py.

References _request(), _upload(), and _with_curves().

◆ test_layer_upload_config_needs_the_checkout()

test_config_wholesale_replacement.test_layer_upload_config_needs_the_checkout ( client,
layer )

Definition at line 141 of file test_config_wholesale_replacement.py.

References _state(), and _with_curves().

◆ test_layer_upload_config_rotates_and_returns_the_token()

test_config_wholesale_replacement.test_layer_upload_config_rotates_and_returns_the_token ( client,
layer )

Definition at line 125 of file test_config_wholesale_replacement.py.

References _state(), and _with_curves().

◆ test_upload_config_and_simulate_never_swaps_the_session_config()

test_config_wholesale_replacement.test_upload_config_and_simulate_never_swaps_the_session_config ( client,
monkeypatch )
A controller run on an uploaded file is a simulation, not a load.

It used to set_config the uploaded engine for the length of the run (inline on the event loop)
and put the old one back after. Nothing in the run read it, but GET /api/config did: the design
bar's tick saw its own load token and autosaved the uploaded engine into the open design.

Definition at line 208 of file test_config_wholesale_replacement.py.

Variable Documentation

◆ DEFAULT

test_config_wholesale_replacement.DEFAULT = yaml.safe_load(session_mod._DEFAULT_CONFIG_PATH.read_text())

Definition at line 39 of file test_config_wholesale_replacement.py.

◆ reason

test_config_wholesale_replacement.reason

Definition at line 27 of file test_config_wholesale_replacement.py.